|
| Home > Apache Geronimo v2.2 > Documentation > Developing > Tutorials > Developing application clients > Deploying and running Java EE application client |
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 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.
package client; public class MainClient { /** * @param args ignored */ public static void main(String[] args){ System.out.println ("CLIENT RUNNING..."); } }
<?xml version="1.0"?> <application-client xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee [http://java.sun.com/xml/ns/j2ee/applicationclient_1_4.xsd]" version="1.4"> <display-name>EXAMPLE Client</display-name> </application-client>
<?xml version="1.0"?> <application-client xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0" xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"> <dep:client-environment> <dep:moduleId> <dep:groupId>JavaEE5</dep:groupId> <dep:artifactId>EXAMPLEClient</dep:artifactId> <dep:version>2.1</dep:version> <dep:type>car</dep:type> </dep:moduleId> </dep:client-environment> <dep:server-environment> <dep:moduleId> <dep:groupId>JavaEE5</dep:groupId> <dep:artifactId>EXAMPLEClientServer</dep:artifactId> <dep:version>2.1</dep:version> <dep:type>car</dep:type> </dep:moduleId> </dep:server-environment> </application-client>
Manifest-Version: 1.0 Main-Class: client.MainClient \# blank line
MANIFEST must contain the Main-Class and blank line at the end of the file.
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 JavaEE5/EXAMPLEClient/2.1/car java -jar %GERONIMO_HOME%/bin/deployer.jar --user system --password manager --host localhost undeploy JavaEE5/EXAMPLEClientServer/2.1/car java -jar %GERONIMO_HOME%/bin/deployer.jar --user system --password manager deploy app_client.jar pause
After deploy, you will see the two components into Geronimo Web Console: Applications -> App Clients:
JavaEE5/EXAMPLEClient/2.1/car state: stopped JavaEE5/EXAMPLEClientServer/2.1/car state: running
You can run the Application Client with this command:
%GERONIMO_HOME%/bin/client JavaEE5/EXAMPLEClient/2.1/car
You should notice the application client message in the Geronimo console.
|
|
Privacy Policy - Copyright © 2003-2011, The Apache Software Foundation, Licensed under ASL 2.0. |