Launching J2EE client applications

Target Audience and Content

The target audience for this guide is the Client Component provider, i.e. the person in charge of developing the client components on the client side.

The content of this guide is the following:

  1. Target Audience and Content
  2. Launching clients
  3. Configuring client container
  4. Examples

Launching clients

The J2EE client application is a .jar file which can be

All the files required to launch the client container are in the JONAS_ROOT/lib/client.jar file. This jar includes a manifest file with the name of the class to launch. So it's easy to launch the client container.

Just type : java -jar $JONAS_ROOT/lib/client.jar -?. This will launch the client container and display the usage of this client container.

If you want to launch the client container on a remote computer, you have to copy the client.jar and invoke the client container by typing java -jar path_to_your/client.jar

The client which must be launched by the client container is given as an argument of the client container.
example : java -jar client.jar myApplication.ear
or java -jar client.jar myClient.jar.

Configuring client container

JNDI access

An important point of configuration is the JNDI access and the protocol to use.
In the JOnAS server this is done by the carol.properties file.
In the ClientContainer, this is the case too. This file can be used at different levels.
The carol.properties is searched with this priority (high to low) :

A convenient way could be to update the carol.properties of your client container client.jar with your customized carol.properties file.
ie : jar -uf client.jar carol.properties

Trace configuration

The client container client.jar includes a traceclient.properties file. This is the same than the file in JONAS_ROOT/conf directory.
You can use a different configuration file for the traces by using the parameter -traceFile when invoking the client container.
You can also replace the file of the client.jar with the command jar -uf client.jar traceclient.properties

Specifying client to use (EAR case)

An ear can contain many java clients which are described in the application.xml file inside the <module><java> elements.
So when you invoke the client container with your ear, like java -jar client.jar my.ear if there are many clients, you need to specify the java client to use.
If you don't specify the jar client to use, it will take the first client.
In order to specify the jar client to use from an ear, you need to use the argument -jarClient and to give the name of the client to use.
The earsample example in the JOnAS examples has in its ear two java clients.

Specifying directory where unpacking the ear (EAR case)

By default, the client container will use the system property java.io.tmpdir
For use another temporary directory, you can specify the path by giving to the client container the argument -tmpDir

Examples

The earsample and jaasclient examples of the JOnAS examples are packaged to be used by the client container.
The first example demonstrates the client inside an ear as the second one demonstrates the use of a standalone client.