+

Search Tips   |   Advanced Search

Porting a Liberty application that uses MongoDB to the full profile

We can port a Liberty application that uses MongoDB to run on the WebSphere Application Server full profile.

Ensure that the application successfully runs on Liberty Extended profile for WAS v8.5.5.0 or later and the full profile server is at version 8.5.5.1 or later.

Only MongoDB Java driver versions 2.10.1 to 2.12.5 are supported.


Tasks

  1. Use the Liberty profile server.xml file to create the ibm-mongodb.xml file for the full profile environment.

    1. Create a local file called ibm-mongodb.xml with a root element of <ibm-mongodb>.

    2. Copy the <mongo> and <mongoDB> elements from your server.xml file into the ibm-mongodb.xml file and nest them under the root <ibm-mongodb> element. If we have <mongo> or <mongoDB> elements in a file that were included in your server.xml file via the <include> element, we must also copy these elements to the new ibm-mongodb.xml file; for example:
      <ibm-mongodb>
      <mongo id="mongo" libraryRef="mongo-lib" hostNames="localhost" ports="27017"/>
      <mongoDB jndiName="mongo/sampledb" mongoRef="mongo" databaseName="sampleDb"/>
      </ibm-mongodb>
      

      Any <include> elements that are copied from the server.xml file into the ibm-mongodb.xml file are ignored. Also, passwords must be plain text; they cannot be encrypted. Any configuration values that specify a time duration value must be converted to strict integer values. For example, convert 12s to 12000 milliseconds. Configuration elements in the ibm-mongodb.xml file cannot have the same ID as any other element.

  2. Install the ibm-mongodb.xml file into the full profile configuration.

    1. Start the wsadmin scripting tool. To start wsadmin using the Jython language, run the wsadmin -lang jython command from the bin directory of the server profile.

    2. For each server that is taking the configuration from a Liberty server, use the createDocument command to create a new document in the configuration repository. Run the following commands:
      AdminConfig.createDocument("cells/[cell]/nodes/[node]/servers/[server]/ibm-mongodb.xml","[path_to]/ibm-mongodb.xml")
      
      AdminConfig.save()
      

  3. Create an isolated shared library for the MongoDB Java driver. Use this isolated shared library for the application server and use it across all applications that are using MongoDB.

    1. See the documentation about creating shared libraries to learn how to create the shared library for the MongoDB Java driver. The MongoDB Java driver shared library must be an isolated shared library.

  4. Install the application using scripting or the administration console. Be sure to associate the application with the newly-created shared library.

We have ported a Liberty profile application that uses MongoDB so that the application runs in the full profile.

  • Create shared libraries