Creating a Liberty application client manually

You can create a Liberty application client from the command line.

About this task

You enable the Java™ EE Application Client 7.0 feature in the client.xml file only.

Procedure

  1. 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.
  2. 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.
    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.
  3. 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 
  4. Place the EAR file under the wlp/usr/clients/client_name/apps directory.
  5. 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>

For more information about configuring security on the application client, see Configuring security for the Liberty application client container and its applications.


Icon that indicates the type of topic Task topic

File name: twlp_setup_new_client.html