You can port a Liberty application that uses MongoDB to
run on the WebSphere® Application
Server full profile.
Before you begin
Ensure that the application successfully runs on Liberty Extended
profile for WebSphere Application
Server Version 8.5.5.0 or later and the full profile server is at
version 8.5.5.1 or later.
Procedure
- Use the Liberty profile server.xml file to create the ibm-mongodb.xml
file for the full profile environment.
- Create a local file called ibm-mongodb.xml with a root
element of <ibm-mongodb>.
- 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 you have <mongo>
or <mongoDB> elements in a file that were included in your server.xml
file via the <include> element, you 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>
Avoid trouble: 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.
gotcha
- Install the ibm-mongodb.xml file into the full profile
configuration.
- 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.
- 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_name]/nodes/[node_name]/servers/[server_name]/ibm-mongodb.xml","[path_to]/ibm-mongodb.xml")
AdminConfig.save()
- 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.
- 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.
- Install the application using scripting or the administration
console. Be sure to associate the application with the
newly-created shared library.
Results
You have ported a Liberty profile application that uses MongoDB
so that the application runs in the full profile.