我正在使用 Ant 脚本在移动第一服务器中部署一个 war 文件以创建运行时。但是我不确定 ANT 脚本,我收到有关数据库配置的错误。
这是我在运行 Ant 脚本时遇到的错误:
Building project
command: 'C:Program Filesagentoptapache-ant-1.8.4binant.bat' -f 'C:Program FilesagentvarworkMF-Componentwardeploy.xml'
Buildfile: C:Program FilesagentvarworkMF-Componentwardeploy.xml
install:
[configureapplicationserver] Logging output of task <configureApplicationServer> to file C:UsersmiracleDocumentsIBM MobileFirst Platform Server DataConfiguration LogsconfigureApplicationServer_2016_02_12_03_35_41.log
[configureapplicationserver] WARNING: The Reports database is deprecated in IBM MobileFirst Platform Foundation since V7.0.0.
[configureapplicationserver] Use Operational Analytics instead.
[configureapplicationserver] See http://ibm.biz/knowctr#SSHS8R_7.1.0/com.ibm.worklight.monitor.doc/monitor/c_op_analytics_overview.html
BUILD FAILED
C:Program FilesagentvarworkMF-Componentwardeploy.xml:33: Element <db2> inside <database kind="Worklight"> inside <configureApplicationServer>: Database does not contain the expected tables. The test table GADGET_USER_PREF was not found.
You may create the required tables through an invocation of <configureDatabase>.
Total time: 4 seconds
Caught: com.urbancode.air.ExitCodeException: Command failed with exit code: 1
com.urbancode.air.ExitCodeException: Command failed with exit code: 1
at com.urbancode.air.CommandHelper.runCommand(CommandHelper.groovy:195)
at com.urbancode.air.CommandHelper$runCommand$0.callCurrent(Unknown Source)
at com.urbancode.air.CommandHelper.runCommand(CommandHelper.groovy:121)
at com.urbancode.air.CommandHelper$runCommand.call(Unknown Source)
at ant.run(ant.groovy:123)
在这里,我不需要任何表来部署战争文件,但它要求表。为了部署战争文件,它需要有数据库。我已经提供了凭据,但它显示了上述一些错误。
这是我正在使用的 Ant 脚本。
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="install">
<taskdef resource="com/worklight/ant/deployers/antlib.xml">
<classpath>
<pathelement location="C:Program FilesIBMMobileFirst_Platform_ServerWorklightServerworklight-ant-deployer.jar"/>
</classpath>
</taskdef>
<target name="databases">
<configuredatabase kind="Worklight">
<db2 database="TESTDB" server="172.17.0.177" user="mobusr4" password="mobileuser4">
</db2>
<driverclasspath>
<fileset dir="C:Program FilesIBMWebSphereLibertyusrsharedresourcesworklight_1db2">
<include name="db2jcc4.jar"/>
<include name="db2jcc_license_*.jar"/>
</fileset>
</driverclasspath>
</configuredatabase>
<configuredatabase kind="WorklightReports">
<db2 database="TESTDB" server="172.17.0.177" user="mobusr4" password="mobileuser4">
</db2>
<driverclasspath>
<fileset dir="C:Program FilesIBMWebSphereLibertyusrsharedresourcesworklight_1db2">
<include name="db2jcc4.jar"/>
<include name="db2jcc_license_*.jar"/>
</fileset>
</driverclasspath>
</configuredatabase>
</target>
<target name="install">
<configureapplicationserver>
<project warfile="C:Program FilesagentvarworkMF-ComponentbinGit_Demo.war" libraryfile="C:Program FilesIBMMobileFirst_Platform_ServerWorklightServerworklight-jee-library.jar"/>
<!-- Here you can define values which override the
default values of Worklight configuration properties -->
<property name="serverSessionTimeout" value="10"/>
<applicationserver>
<websphereapplicationserver installdir="C:Program FilesIBMWebSphereLiberty"
profile="Liberty"
user="admin" password="admin">
<server name="UCDServer"/>
</websphereapplicationserver>
</applicationserver>
<database kind="Worklight">
<db2 database="TESTDB" server="172.17.0.177" user="mobusr4" password="mobileuser4"/>
<driverclasspath>
<fileset dir="C:Program FilesIBMWebSphereLibertyusrsharedresourcesworklight_1db2">
<include name="db2jcc4.jar"/>
<include name="db2jcc_license_*.jar"/>
</fileset>
</driverclasspath>
</database>
<database kind="WorklightReports">
<db2 database="TESTDB" server="172.17.0.177" user="mobusr4" password="mobileuser4"/>
<driverclasspath>
<fileset dir="C:Program FilesIBMWebSphereLibertyusrsharedresourcesworklight_1db2">
<include name="db2jcc4.jar"/>
<include name="db2jcc_license_*.jar"/>
</fileset>
</driverclasspath>
</database>
</configureapplicationserver>
</target>
</project>
这是正确的,WAR 文件需要有一个数据库。在应用程序服务器中创建数据源之前,配置数据库 Ant 任务会验证数据源是否存在并具有正确的表。它没有找到它并失败并出现错误。
要创建数据库表,请在 ant 文件中运行"数据库"目标。
有关详细信息,请参阅 https://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.deploy.doc/devref/c_project_war_file_ant_tasks.html