You can create a Liberty
application client from the command line.
About this task
You enable the Java™ EE Application Client 7.0 or Java EE Application Client 8.0 feature in the
client.xml
file only.Note: The following steps include directions for how to
create a Liberty application client manually
by using the javaeeClient-7.0
feature. These directions also apply to
configurations that use the javaeeClient-8.0
feature.
Procedure
-
Open a command line, then change directory to the
wlp/bin
directory.
In the following examples, path_to_liberty specifies the location where you
installed Liberty on your operating
system.
Example on Windows systems:
C:\Users\mo> cd path_to_liberty\wlp\bin
Example on Linux®: mo@machine01:~> cd
path_to_liberty/wlp/bin
- Run the following command to create a client, where client_name is the
name that you want to give your client. If you do not specify a client name,
defaultClient is used.
Example on Windows systems:
C:\wlp\bin> client create client_name
Example on Linux: mo@machine01:~> client create
client_name
client create client_name
If the client is created successfully, you receive the following message:
Client client_name created.
You can find the
client.xml
file in the
wlp/usr/clients/client_name
directory. The file contains the
javaeeClient-7.0
feature.
Attention: If a default client exists, you get an error. If a default client does not exist,
defaultClient
is created.
- Run your client application by preparing an application (
.ear
) file with
a client module (.jar
) in it. Specify a main class in the
MANIFEST.MF
of the client module, for example:
Manifest-Version: 1.0
Main-Class: com.ibm.ws.addressbook.ContactServiceClient_XMLInject
- Place the EAR file under the
wlp/usr/clients/client_name/apps
directory.
- Update the
client.xml
file to configure your application, for
example:
<client>
<featureManager>
<feature>javaeeClient-7.0</feature>
<featureManager>
<application id="CLIENT_APP" name="CLIENT_APP" type="ear" location="clientApp.ear"/>
</client>
If the specified client already exists, no client is created and you receive an exception
message:
CWWKE0005E: The runtime environment could not be launched.
CWWKE0904E: It was not possible to create the client called client_name because
the client directory C:\wlp\usr\clients\client_name already exists.
What to do next
You can enable security (SSL, CSIv2, JAAS) for your application client by
adding the
appSecurityClient-1.0
feature to your
client.xml
file:
<featureManager>
<feature>javaeeClient-7.0</feature>
<feature>appSecurityClient-1.0</feature>
</featureManager>
See information about configuring
security on the application client.