Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

You can create an application client that runs in the Apache Geronimo application client container rather than running in your local Java environment. The main purpose of the Geronimo client application container is to provide a standard set of services to a client program without forcing the client application to specify a list of dependencies - in other words ease-of-development. The client code can lookup Geronimono Geronimo components such as resources, EJBs, and connectors via standard JNDI lookup. This example creates the simplest application client that can talk to a Geronimo server and place a message in the Geronimo console.

Create a client jar file for a simple example with these files. The client will write a message "CLIENT RUNNING..." on the Geronimo console:

...

Code Block
xml
xml
borderStylesolid
<?xml version="1.0"?>
<application-client xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-client-12.20" xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
    <dep:client-environment>
        <dep:moduleId>
            <dep:groupId>JEE5<groupId>JavaEE5</dep:groupId>
            <dep:artifactId>EXAMPLEClient</dep:artifactId>
            <dep:version>1version>2.1</dep:version>
            <dep:type>car</dep:type>
        </dep:moduleId>
    </dep:client-environment>

    <dep:server-environment>
        <dep:moduleId>
            <dep:groupId>JEE5<groupId>JavaEE5</dep:groupId>
	    <dep:artifactId>EXAMPLEClientServer</dep:artifactId>
	    <dep:version>1version>2.1</dep:version>
	    <dep:type>car</dep:type>
        </dep:moduleId>
    </dep:server-environment>
    
</application-client>

...

No Format
borderStylesolid
jar -cfM  app_client.jar -C D:\workspace2\GERONIMO_APPLICATION\bin .
java -jar %GERONIMO_HOME%/bin/deployer.jar --user system --password manager --host localhost undeploy JEE5JavaEE5/EXAMPLEClient/2.1/car
java -jar %GERONIMO_HOME%/bin/deployer.jar --user system --password manager --host localhost undeploy JEE5JavaEE5/EXAMPLEClientServer/2.1/car
java -jar %GERONIMO_HOME%/bin/deployer.jar --user system --password manager deploy app_client.jar
pause

...

No Format
borderStylesolid
JEE5JavaEE5/EXAMPLEClient/2.1/car    	   state: stopped
JEE5JavaEE5/EXAMPLEClientServer/2.1/car   state: running

You can run the Application Client with this command:

java -jar %GERONIMO_HOME%/bin/client .jar JEE5JavaEE5/EXAMPLEClient/2.1/car

You should notice the application client message in the Geronimo console.