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
- Prepare your server.
- 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.
An example of an apps directory is wlp/usr/servers/your_server/apps.
- Update the
server.xml
configuration file by adding theappClientSupport-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.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>
- Package a client module (
-
Prepare your client.
- Place the EAR file in the apps directory.
An example directory is wlp/usr/clients/your_client/apps.
- 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>
- Optional: Add the
appClientSupport-1.0
feature to theclient.xml
file.For more information, see 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
- Place the EAR file in the apps directory.
- 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
.- Stop the server.
- 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" />
- 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" />
- Start the server.
Note: 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.