For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Set up JNDI properties for MobileFirst Server web applications
Set up JNDI properties to configure the MobileFirst Server web applications that are deployed to the application server.
JNDI environment entries cover all the properties that we can set in a production environment. For details about specific JNDI entries, see List of JNDI properties for MobileFirst Server administration service, List of JNDI properties for MobileFirst Server live update service, List of JNDI properties for MobileFirst runtime, and List of JNDI properties for MobileFirst Server push service.
Procedure
Set the JNDI environment entries in one of the following ways:
- Configure the server environment entries. The steps to configure the server environment entries depends on which application server we use:
WebSphere® Application Server:
- In the WebSphere Application Server administration console, go to Applications > Application Types > WebSphere enterprise applications > application_name > Environment entries for Web modules
- In the Value fields, enter values that are appropriate to our server environment.
Figure 1. Setting JNDI environment entries on WebSphere Application Server
WebSphere Application Server Liberty:
- In liberty_install_dir/usr/servers/serverName, edit the server.xml file, and declare the JNDI properties as follows:
<application id="app_context_root" name="app_context_root" location="app_war_name.war" type="war"> ... </application> <jndiEntry jndiName="app_context_root/JNDI_property_name" value="JNDI_property_value" />
The context root (in the previous example: app_context_root) connects between the JNDI entry and a specific MobileFirst application. If multiple MobileFirst applications exist on the same server, we can define specific JNDI entries for each application by using the context path prefix.
Note: Some properties are defined globally on WebSphere Application Server Liberty, without prefixing the property name by the context root. For a list of these properties, see Global JNDI entries.
For all other JNDI properties, the names must be prefixed with the context root of the application:
- For the MobileFirst Administration Service application, the MobileFirst Operations Console and MobileFirst runtime, we can define the context root as we want. However, by default it is /mfpadmin for MobileFirst Administration Service, /mfpconsole for MobileFirst Operations Console, and /mfp for MobileFirst runtime.
- For the live update service, the context root must be /<adminContextRoot>config. For example, if the context root of the administration service is /mfpadmin, then the context root of the live update service must be /mfpadminconfig.
- For the push service, we must define the context root as /imfpush. Otherwise, the client devices cannot connect to it as the context root is hardcoded in the SDK.
For example:
<application id="mfpadmin" name="mfpadmin" location="mfp-admin-service.war" type="war"> ... </application> <jndiEntry jndiName="mfpadmin/mfp.admin.actions.prepareTimeout" value = "2400000" />
Apache Tomcat:
- In tomcat_install_dir/conf, edit the server.xml file, and declare the JNDI properties as follows:
<Context docBase="app_context_root" path="/app_context_root"> <Environment name="JNDI_property_name" override="false" type="java.lang.String" value="JNDI_property_value"/> </Context>
- The context path prefix is not needed because the JNDI entries are defined inside the <Context> element of an application.
- override="false" is mandatory.
- The type attribute is always java.lang.String, unless specified differently for the property.
For example:
<Context docBase="app_context_root" path="/app_context_root"> <Environment name="mfp.admin.actions.prepareTimeout" override="false" type="java.lang.String" value="2400000"/> </Context>
If you install with Ant tasks, we can also set the values of the JNDI properties at installation time. In mfp_install_dir/MobileFirstServer/configuration-samples, edit the configuration XML file for the Ant tasks, and declare the values for the JNDI properties by using the property element inside the following tags:
- <installmobilefirstadmin>, for MobileFirst Server administration, MobileFirst Operations Console, and live update services. For more information, see Ant tasks for installation of MobileFirst Operations Console, MobileFirst Server artifacts, MobileFirst Server administration, and live update services.
- <installmobilefirstruntime>, for MobileFirst runtime configuration properties. For more information, see Ant tasks for installation of MobileFirst runtime environments.
- <installmobilefirstpush>, for configuration of the push service. For more information, see Ant tasks for installation of MobileFirst Server push service.
For example:
<installmobilefirstadmin ..> <property name = "mfp.admin.actions.prepareTimeout" value = "2400000" /> </installmobilefirstadmin>
Parent topic: List of JNDI properties of the MobileFirst Server web applications