Deploying to WebSphere Liberty

This section describes deploying an application to WebSphere Liberty by adding it to the server configuration file. For detailed instructions about deploying applications in WebSphere Liberty, refer to the WebSphere Liberty documentation on the web: Deploying applications in Liberty

Add the restcfgdir environment variable to the server.env file

The server.env file is where various environment variables can be added and made available for the WebSphere Liberty server to use.

  1. Open the server.env file. This file is typically found in <liberty install dir>/wlp/usr/servers/defaultServer
  2. Add the restcfgdir environment variable and set its value to the full path to the directory that was specified for the ODRESTAdmin setup command.
    restcfgdir=<configuration directory>
  3. Save the file.

Edit the server.xml file

  1. Add the webProfile feature.
    <featureManager>
       <feature>jsp-2.3</feature>
       <feature>webProfile-8.0</feature>
    </featureManager>       
  2. Add a new library definition.
    <variable name="odjars" value=" C:/Program Files/IBM/OnDemand/V10.5/jars" />
    <variable name="odapi" value=" C:/Program Files/IBM/OnDemand/V10.5/www/api" />
    <library id="odlibs">
         <file name="${odapi}/ODApi.jar" />
         <file name="${odjars}/gson-2.9.0.jar" />
         <file name="${odjars}/log4j-core-2.18.0.jar" />
         <file name="${odjars}/log4j-api-2.18.0.jar" />
         <file name="${odjars}/commons-pool2-2.11.1.jar" />
    </library>

    When specifying the version for gson, commons-pool, and log4j, ensure that the version matches the version that is installed with Content Manager OnDemand. Newer versions might be installed with a Content Manager OnDemand upgrade.

  3. Add the application stanza.
    <webApplication id="cmod-rest" location="cmod-rest.war" name="cmod-rest">
         <classloader commonLibraryRef="odlibs" />
    </webApplication>        
  4. Copy the cmod-rest.war file into the <liberty install dir>\wlp\usr\servers\defaultServer\apps directory.
  5. Start the server.

Content Manager OnDemand REST Services should now be deployed and running on WebSphere Liberty. Refer to the application server logs for information about REST Services startup. All information, including connection pool initialization, is logged there. In addition, REST Services also logs information to the file named arsrestapi.log. For a default installation, this file can be found in <liberty install dir>/wlp/usr/servers/defaultServer/logs.