0
votes

I am using mobileFirst CLI for deployment of war file using ant script. Giving the path of mfp-cli web server directory and derby database.

below is my code:

       <target name="database">
   <configuredatabase kind="Worklight">
    <derby database="WRKLGHT" datadir="${path-to-mfpcli}/derby/TestProj"/>
   </configuredatabase>
  <configuredatabase kind="WorklightReports">
  <derby database="WLREPORT" datadir="${path-to-mfpcli}/derby/TestProj"/>
   </configuredatabase>
   </target>

  <target name="install">
   <configureapplicationserver id="TestProj" environmentId="TestProj">
  <project warfile="${path-to-project}/TestProj.war" libraryfile="${path-to-worklight-jee}/worklight-jee-library-7.0.0.jar"/>

  <!-- Here you can define values which override the 
       default values of Worklight configuration properties -->
  <property name="serverSessionTimeout" value="10"/>    

  <applicationserver>

    <websphereapplicationserver installdir="${websphere-server-installed-directory}/wlp" profile="Liberty" user="admin" password="admin">
      <server name="worklight"/>
    </websphereapplicationserver>
  </applicationserver>
  <database kind="Worklight">
    <derby database="WRKLGHT" datadir="${path-to-mfpcli}/derby/TestProj"/>
  </database>
  <database kind="WorklightReports">
    <derby database="WLREPORT" datadir="${path-to-mfpcli}/derby/TestProj"/>
  </database>
</configureapplicationserver>

The server.xml is getting updated as below:

 <server description="worklight">

 <featureManager>
    <feature>servlet-3.0</feature>
    <feature>jndi-1.0</feature>
    <feature>jdbc-4.0</feature>
    <feature>localConnector-1.0</feature>
    <feature>restConnector-1.0</feature>
    <feature>jsp-2.2</feature>
    <feature>appSecurity-1.0</feature>
    <feature>ssl-1.0</feature>
 </featureManager>
 <webContainer invokeFlushAfterService="false" deferServletLoad="false"/>
<webContainer com.ibm.ws.webcontainer.suppressLoggingServiceRuntimeExcep="true" invokeFlushAfterService="false" deferServletLoad="false"/>
<webContainer deferServletLoad="false" invokeFlushAfterService="false"/>

<!-- non standard ports were used to avoid future collision with other WebSphere products. -->
<httpEndpoint id="defaultHttpEndpoint"
              host="*"
              httpPort="10080"
              httpsPort="10443" >
    <tcpOptions soReuseAddr="true"/>
</httpEndpoint>
<logging consoleLogLevel="AUDIT" copySystemStreams="false"/>
<applicationMonitor updateTrigger="mbean"/>
<executor name="LargeThreadPool" id="default" coreThreads="200" maxThreads="400" keepAlive="60s" stealPolicy="STRICT" rejectedWorkPolicy="CALLER_RUNS"/>
<administrator-role>
   <user>admin</user>
</administrator-role>
<keyStore id="defaultKeyStore" password="worklight"/>
<jndiEntry jndiName="ibm.worklight.admin.jmx.host" value="localhost"/>
<jndiEntry jndiName="ibm.worklight.admin.jmx.port" value="10443"/>
<jndiEntry jndiName="ibm.worklight.topology.platform" value="Liberty"/>
<jndiEntry jndiName="ibm.worklight.topology.clustermode" value="Standalone"/>
<application context-root="analytics-service" id="analytics-service" location="analytics-service.war" name="AnalyticsServices" type="war">
    <application-bnd>
        <security-role name="worklightadmin">
            <user name="admin"/>
        </security-role>
            <security-role name="worklightdeployer">
            <user name="deployer"/>
        </security-role>
            <security-role name="worklightmonitor">
            <user name="monitor"/>
        </security-role>
            <security-role name="worklightoperator">
            <user name="operator"/>
        </security-role>
    </application-bnd>
</application>
<application context-root="analytics" id="analytics" location="analytics.war" name="Analytics" type="war">
    <application-bnd>
        <security-role name="worklightadmin">
            <user name="admin"/>
        </security-role>
            <security-role name="worklightdeployer">
            <user name="deployer"/>
        </security-role>
            <security-role name="worklightmonitor">
            <user name="monitor"/>
        </security-role>
            <security-role name="worklightoperator">
            <user name="operator"/>
        </security-role>
    </application-bnd>
</application>
<!-- Begin of configuration added by IBM Worklight <configureApplicationServer> ant task for context root '/worklight'. -->

<!-- Declare the IBM Worklight project runtime application. -->
<application id="worklight" name="worklight" location="TestProj.war" type="war">
    <classloader delegation="parentLast">
        <privateLibrary id="worklightlib_worklight">
            <fileset dir="${shared.resource.dir}/worklight/lib" includes="worklight-jee-library-7.0.0.jar"/>
            <fileset dir="${wlp.install.dir}/lib" includes="com.ibm.ws.crypto.passwordutil_1.0.1.jar"/>
        </privateLibrary>
    </classloader>
</application>

<!-- Declare the JNDI properties for the IBM Worklight project runtime. -->
<jndiEntry jndiName="worklight/publicWorkLightProtocol" value='"http"'/>
<jndiEntry jndiName="worklight/publicWorkLightPort" value='"10080"'/>
<jndiEntry jndiName="worklight/ibm.worklight.admin.environmentid" value='"TestProj"'/>
<jndiEntry jndiName="worklight/serverSessionTimeout" value='"10"'/>


<!-- Declare the jar file for Derby with the "embedded" deployment option. -->
<library id="worklight/DerbyLib">
    <fileset dir="${shared.resource.dir}/worklight/derby" includes="derby.jar"/>
</library>

<!-- Declare the IBM Worklight Server database. -->
<dataSource jndiName="worklight/jdbc/WorklightDS" transactional="false">
    <jdbcDriver libraryRef="worklight/DerbyLib"/>
    <properties.derby.embedded databaseName="${path-to-mfpcli}/TestProj/WRKLGHT" user='"WORKLIGHT"'/>
</dataSource>

<!-- Declare the IBM Worklight Server reports database. -->
<dataSource jndiName="worklight/jdbc/WorklightReportsDS" transactional="false">
    <jdbcDriver libraryRef="worklight/DerbyLib"/>
    <properties.derby.embedded databaseName="${path-to-mfpcli}/TestProj/WLREPORT" user='"WORKLIGHT"'/>
</dataSource>

<!-- End of configuration added by IBM Worklight <configureApplicationServer> ant task for context root '/worklight'. -->

But here ID and name of the TestProj.war code in server.xml is "worklight" I am not getting how it came as default value and while running the server the runtime environment is showing as worklight. I am not able to deploy my app because of it as it throws an error MBean not found.

1
Please mention which MobileFirst version and its build number...Idan Adar

1 Answers

0
votes

In

<configureapplicationserver id="TestProj" environmentId="TestProj">

You don't need id. This attribute is only used if you deploy in WAS full profile (to add a suffix to the objects created in WAS an allow multipled deployments in a cell)

You probably don't need environmentId. This is used if you deploy several instances of MFP admin in the same applicaiton server. If you add it, the admin must have the same or you have an MBean not found error.

To change the contextRoot, use the attribute contextroot

  <configureapplicationserver contextRoot="/TestProj">

For reference, see https://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.0.0/com.ibm.worklight.reference.doc/devref/r_ant_tasks_configure_appserver_reference.html