Configuring the Liberty profile to use the data grid for session management

If you have client applications that use session management and are deployed in the WebSphere® Application Server Liberty profile, then you can configure the Liberty profile to use the data grid in the appliance to manage those applications.

Before you begin

About this task

Just as you can configure your WebSphere Application Server applications to use the appliance for session management, you can complete the same configuration for the Liberty profile.

Use the Liberty profile with the appliance if you require a lightweight server with dynamic capabilities. You can add or remove features, which are units of capability that control how the server interacts with the data grid on the appliance. In the Liberty profile, if you want to run applications that manage sessions, then create a server definition where you specify Liberty profile features.

Procedure

  1. Create an HTTP session data grid. In the appliance user interface, click Data Grid > Session. Click the add icon (plus sign icon ) and specify a name for the session data grid that you want to create. By default, the session manager provider is configured to work with a data grid named session.
  2. Create a Liberty profile server definition file by running the following command:
    wlp_install_root/bin/server create server_name
  3. Locate the server.xml file under your server definition, and open it in an XML editor. Locate the server.xml file in the following directory:
    wlp_install_root/usr/servers/server_name/server.xml 
  4. Put the session application in the Liberty profile. For example, place the A.jar file, in the wlp_install_root/usr/servers/server_name/apps directory.
  5. For client machines with multiple IP addresses, set the following property in the objectGridClient.properties file:
    listenerHost
    Specifies the host name to which the Object Request Broker (ORB) transport protocol binds for communication. The value must be a fully qualified domain name or IP address. If your configuration involves multiple network cards, set the listener host and port to let the transport mechanism in the JVM know the IP address for which to bind. If you do not specify which IP address to use, symptoms such as connection timeouts, unusual API failures, and clients that seem to hang can occur.
  6. Configure the Liberty profile to use the appliance for HTTP session management by setting the Liberty profile WebApp feature, which supports replication of HTTP session data for fault tolerance. See the following server.xml file example:
    <server description="new server">
    
        <!-- Enable features -->
        <featureManager>
            <feature>servlet-3.0</feature>
            <feature>eXtremeScale.webapp-1.1</feature>
        </featureManager>

    In the previous example, the servlet 3.0 feature is enabled because session applications are deployed as web applications. You must package servlets in a web application archive (WAR) file or web module for deployment to the application server.

  7. Configure the server.xml file to make a connection to the data grid. Specify the keystore and truststore information to establish trusted communicate between the data grid and the Liberty profile. The WebApp feature contains properties that create a connection between the appliance and the Liberty profile. For example, catalogHostPort specifies the data grid port number that Liberty profile connects to.
    <keyStore id="defaultKeyStore" location="/opt/liberty/xsakeystore.jks" password="xc10pass" type="jks"/>
    <keyStore id="defaultTrustStore" location="/opt/liberty/xsatruststore.jks" password="xc10pass" type="jks"/>
    
    <xsWebApp 
    	applianceIdentifier="10.1.1.135" 
    	objectGridName="session" 
    	catalogHostPort="10.1.1.135:2809" 
    	securityEnabled="false" />
    </server>
  8. Optional: Enter the HTTP session endpoints and the location of the application that will use HTTP session replication. In this step you are specifying the application that will run in the Liberty profile. The httpEndpoint ID is a Liberty profile property that specifies the address and port number that the server listens. Although this property is not specific to the appliance, you must use this property for clients that connect to the web server. See the following example:
    <httpEndpoint id="defaultHttpEndpoint"
                      host="10.1.1.13"
                      httpPort="9080" />
    
    <application location="A.ear"
                     name="A"
                     type="ear"
                     context-root="/A"
                     autoStart="true" />
  9. Start the Liberty profile using the following command:
    ./server start server_name
    A PID is displayed.
  10. Open the session application using the following URL, where A is the application that you want to use for session replication; for example:
    http://server:9080/A/
  11. Run a session load against your application to verify that the data is written to the session grid in the appliance.

Server definition file without SSL enabled

See the following example of a basic server.xml file that has no SSL enabled. This example is displayed on multiple lines for publication purposes.
Note: The web feature is deprecated. Use the webApp feature instead. When you add the webApp feature to the server definition and configure the session manager, you can use session replication in your WebSphere® eXtreme Scale applications that run in the Liberty profile.

[Version 2.1 only][Firmware refresh Version 2.1.0.3 only]
<server description="new server">

    <!-- Enable features -->
    <featureManager>
        <feature>jsp-2.2</feature>
      <feature>eXtremeScale.server-1.0</feature>
		 <feature>servlet-3.0</feature>
      <feature>eXtremeScale.web-1.0</feature>
    </featureManager>

    <httpEndpoint id="defaultHttpEndpoint"
                  host="*"
                  httpPort="9080"
                  httpsPort="9443" />

    <xsWebAppV85 objectGridName="session" catalogHostPort="<applianceURL>:2809" securityEnabled="false" />
    <applicationMonitor updateTrigger="mbean"/>
    <application id="A" location="A.ear" name="A" type="ear"/>
    <httpSession cloneId="A_test"/>

  </server>

See the following example where the webApp feature is used: