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:
- Package a client module (.jar) and other modules, such as an
EJB module (.jar), in an application EAR file.
- Place the EAR file in the apps directory; for example,
wlp/usr/servers/your_server/apps.
- 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.
- 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:
- Place the EAR file in the apps directory; for example,
wlp/usr/clients/your_client/apps.
- 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>
- Optional: Add the
appClientSecurity-1.0 feature to the
client.xml file. Read about Creating a Liberty application client manually.
- Start the server.
- 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:
- Stop the server.
- Update the server.xml file with the IIOP configuration; for
example:
<iiopEndpoint id="defaultIiopEndpoint" host="user.host.ibm.com" iiopPort="2814" />
- Update the client.xml file with the IIOP configuration; for
example:
<orb id="defaultOrb" nameService="corbaname::user.host.ibm.com:2814" />
- Start the server.
Note: The client may fail to connect to the server due
to firewall software blocking the connection on the server. Consult with the
server administrator to ensure there is no firewall blocking inbound
connections to port 2814.