2016-02-12 53 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

相關問題