ANT脚本在MobileFirst Server中部署War文件以创建运行时

时间:2016-02-12 11:40:20

标签: ant war ibm-mobilefirst mobilefirst-server

我正在使用Ant脚本在移动第一台服务器中部署war文件以创建运行时。但我不确定ANT脚本,我收到有关数据库配置的错误。

这是我通过运行Ant脚本得到的错误:

     Building project
        command: 'C:\Program Files\agent\opt\apache-ant-1.8.4\bin\ant.bat' -f 'C:\Program Files\agent\var\work\MF-Component\wardeploy.xml'
        Buildfile: C:\Program Files\agent\var\work\MF-Component\wardeploy.xml

        install:
        [configureapplicationserver] Logging output of task <configureApplicationServer> to file C:\Users\miracle\Documents\IBM MobileFirst Platform Server Data\Configuration Logs\configureApplicationServer_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 Files\agent\var\work\MF-Component\wardeploy.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)

这里我不需要任何表来部署war文件,但是它要求表。对于部署war文件,它需要有数据库。我已经提供了凭据,但它显示了一些错误。

这是我正在使用的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 Files\IBM\MobileFirst_Platform_Server\WorklightServer\worklight-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 Files\IBM\WebSphere\Liberty\usr\shared\resources\worklight_1\db2">
              <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 Files\IBM\WebSphere\Liberty\usr\shared\resources\worklight_1\db2">
              <include name="db2jcc4.jar"/>
              <include name="db2jcc_license_*.jar"/>
            </fileset>
          </driverclasspath>
        </configuredatabase>
      </target>

      <target name="install">
        <configureapplicationserver>
          <project warfile="C:\Program Files\agent\var\work\MF-Component\bin\Git_Demo.war" libraryfile="C:\Program Files\IBM\MobileFirst_Platform_Server\WorklightServer\worklight-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 Files\IBM\WebSphere\Liberty"
                                        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 Files\IBM\WebSphere\Liberty\usr\shared\resources\worklight_1\db2">
                <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 Files\IBM\WebSphere\Liberty\usr\shared\resources\worklight_1\db2">
                <include name="db2jcc4.jar"/>
                <include name="db2jcc_license_*.jar"/>
              </fileset>
            </driverclasspath>
          </database>
        </configureapplicationserver>
      </target>
      </project>

1 个答案:

答案 0 :(得分:1)

这是正确的,WAR文件需要有一个数据库。在应用程序服务器中创建数据源之前,configuredatabase Ant任务会验证数据源是否存在并具有正确的表。它没有找到它并因错误而失败。

要创建数据库表,请运行&#39;数据库&#39;你的蚂蚁文件中的目标。

有关详细信息,请参阅https://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.deploy.doc/devref/c_project_war_file_ant_tasks.html