Note: For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.

Setting 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.

About this task

JNDI environment entries cover all the properties that you 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 you use:
    • WebSphere® Application Server:
      1. In the WebSphere Application Server administration console, go to Applications > Application Types > WebSphere enterprise applications > application_name > Environment entries for Web modules
      2. In the Value fields, enter values that are appropriate to your server environment.
        Figure 1. Setting JNDI environment entries on WebSphere Application Server
        The screen capture shows the table for setting environment entries for web modules in the WebSphere Application Server administration console.
    • WebSphere Application Server Liberty:
      1. 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, you 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, you can define the context root as you 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, you 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:
      1. 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, you 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:

    For example:
    <installmobilefirstadmin ..>
       <property name = "mfp.admin.actions.prepareTimeout" value = "2400000" />
    </installmobilefirstadmin>