2016-02-12 45 views
0

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

这是我通过运行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

这是正确的,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

相关问题