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

This task includes instructions for deploying an application that requires session management. To create a Java application that uses session management, see Developing data grid applications with Java APIs.

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.

You might decide to use the Liberty profile with the appliance if you require a lightweight server with dynamic capabilities. For example, you can add or remove features, which are units of capability by which you control the pieces of the runtime environment that are loaded into a particular server. Therefore, in the Liberty profile if you run applications that manage sessions, for example, then you can create a server definition that you use to specify Liberty profile features, which control how the server interacts with the data grid on the appliance.

Procedure

  1. Create a server definition by running the following command:
    wlp_install_root/bin/server create server_name
  2. Locate the server.xml file under your server definition, and open it in an XML editor.
  3. Put the session application, for example your_application.jar, in the /wlp/usr/servers/defaultServer/apps directory.
  4. Start the monitoring console for the appliance, and click Data grid > Session grid.
  5. Create a session grid in the appliance named session.
  6. Export the JAVA_HOME property from a command line. Be sure to issue the command from the directory where the Liberty profile is installed.
  7. Start the Liberty profile using the following command:
    ./server start servername
    A PID is displayed.
  8. Open the session application using the following URL:
    http://server:port/A/
  9. Perform session testing 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.

See the following example where the webApp feature is used:


[Version 2.5 and later]
<server description="new server">

    <!-- Enable features -->
    <featureManager>
        <feature>jsp-2.2</feature>
      <feature>eXtremeScale.server-1.1</feature>
      <feature>eXtremeScale.webApp-1.1</feature>
    </featureManager>

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

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

   <!-- <com.ibm.ws.xs.server.config catalogServer="true" /> -->
</server>