Preparing and running an application client

You can prepare your server and client to run an application client from the Liberty application client container. Updates to both the server.xml and client.xml files are required.

About this task

Running an application client successfully requires updates to both the server.xml and client.xml files.

Procedure

  1. Prepare your server.
    1. Package a client module (.jar) and other modules, such as an EJB module (.jar), in an application EAR file.
    2. Place the EAR file in the apps directory.

      An example of an apps directory is wlp/usr/servers/your_server/apps.

    3. Update the server.xml configuration file by adding the appClientSupport-1.0 feature, along with other necessary features.
      Important: This step is not needed if your application client is a stand-alone application.
    4. Update the server.xml configuration file by configuring <application/> with your application information.

      The following example shows what to add to the server.xml configuration file.

      <?xml version="1.0" encoding="UTF-8"?>
      	<server description="new server">
      		<!- Enable features ->
      		<featureManager>
      			<feature>javaee-7.0</feature>
      		</featureManager>
      		<application id="techsample" name="techSample" type="ear" location="TechnologySamples.ear"/>
      	</server>
  2. Prepare your client.
    1. Place the EAR file in the apps directory.

      An example directory is wlp/usr/clients/your_client/apps.

    2. Update the client.xml configuration file by configuring <application/> with your application information.

      The following example shows what to add to the client.xml configuration file.

      <?xml version="1.0" encoding="UTF-8"?>
      	<client description="new client">
      		<!- Enable features ->
      		<featureManager>
      			<feature>javaeeClient-7.0</feature>
      		</featureManager>
      		<application id="techsample" name="techSample" type="ear" location="TechnologySamples.ear"/>
      	</client>
    3. Optional: Add the appClientSupport-1.0 feature to the client.xml file.
    4. Start the server.
    5. Run the client by entering client run your_client.
      If your client application uses command-line arguments, use the following format:
      client run {your_client} -- arg1 arg2 ... argn
  3. If your server and client are running on different computers, configure IIOP to establish a connection between the server and client.

    By default, the server and client are using localhost:2809.

    1. Stop the server.
    2. Update the server.xml file with the IIOP configuration.

      The following example shows what to add to the server.xml file.

      <iiopEndpoint id="defaultIiopEndpoint" host="user.host.ibm.com" iiopPort="2814" />
    3. Update the client.xml file with the IIOP configuration.

      The following example shows what to add to the client.xml file.

      <orb id="defaultOrb" nameService="corbaname::user.host.ibm.com:2814" />
    4. Start the server.
      For Windows platformsNote: The client might fail to connect to the server due to firewall software that blocks the connection on the server. Consult with the server administrator to ensure that no firewall blocks inbound connections to port 2814.