Preparing and running an application client

Learn how to prepare your server and client to run an application client from Liberty application client container.

About this task

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

Procedure

Prepare your server, as follows:

  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; for example, 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; for example:
    <?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>

Prepare your client, as follows:

  1. Place the EAR file in the apps directory; for example, wlp/usr/clients/your_client/apps.
  2. Update the client.xml configuration file by configuring <application/> with your application information; for example:
    <?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. Read about Creating a Liberty application client manually.
  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

There are extra steps to take if your server and client are running on different computers. By default, the server and client are using localhost:2809. You must configure IIOP to establish a connection between the server and client, as follows:

  1. Stop the server.
  2. Update the server.xml file with the IIOP configuration; for example:
    <iiopEndpoint id="defaultIiopEndpoint" host="user.host.ibm.com" iiopPort="2814" />
  3. Update the client.xml file with the IIOP configuration; for example:
    <orb id="defaultOrb" nameService="corbaname::user.host.ibm.com:2814" />
  4. Start the server.

Icon that indicates the type of topic Task topic

File name: twlp_setup_prepareappclient.html