Versions Compared

Key

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

...

The following is the deployment descriptor of the Java EE application client module that looks up an ejb and calls a method on it. The ejb converts the Indian Rupess (Rs.) into American Dollars ($). The client sends a double value which is Indian Rupees to ejb. The ejb returns equivalent American Dollars as double value.

Code Block
XMLXMLborderStylesolid
titleapplication-client.xml
<?xml version="1.0" encoding="UTF-8"?>

<application-client xmlns="http://java.sun.com/xml/ns/javaee" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  http://java.sun.com/xml/ns/javaee/application-client_5.xsd"
  version="5">
    
  <ejb-ref>
    <ejb-ref-name>ejb/Converter</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <remote>examples.appclient.Converter</remote>
  </ejb-ref>

</application-client>
Note

The default namespace of the above XML document is http://java.sun.com/xml/ns/javaeeImage Removed. The XML elements that do not have a namespace prefix belong to the default namespace. Hence, in the above XML document, all the XML elements belong to the default namespace.

...

Following is the corresponding deployment plan of the Java EE client module.

Code Block
XMLXMLborderStylesolid
titlegeronimo-application-client.xml
<?xml version="1.0" encoding="UTF-8"?>

<application-client xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"
  xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"
  xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
  xmlns:security="http://geronimo.apache.org/xml/ns/security-2.0"
  xmlns:connector="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
 
 <sys:client-environment>
  <sys:moduleId>
  <sys:groupId>Converter</sys:groupId>
  <sys:artifactId>Converter-app-client</sys:artifactId>
  <sys:version>3.0</sys:version>
  <sys:type>jar</sys:type>
  </sys:moduleId>
</sys:client-environment>
  
  <sys:server-environment> 
   <sys:moduleId>
   <sys:groupId>Converter</sys:groupId>
   <sys:artifactId>Converter-app-client-server</sys:artifactId>
   <sys:version>3.0</sys:version>
   <sys:type>jar</sys:type>
   </sys:moduleId>    		
  </sys:server-environment> 
    
     <ejb-ref>
     	<ref-name>ejb/Converter</ref-name>
     	<naming:pattern>
         <naming:groupId>Converter</naming:groupId>
         <naming:artifactId>ConverterEAR</naming:artifactId>
         <naming:version>5.0</naming:version>
         <naming:module>ConverterEJB.jar</naming:module>
         <naming:name>ConverterBean</naming:name>
       </naming:pattern>
     </ejb-ref>
     
</application-client>
Note

The default namespace of the above XML document is http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0Image Removed. The XML elements that do not have a namespace prefix belong to the default namespace. Hence, in the above XML document, <application-client>, <ejb-ref> and <ref-name> elements belong to the default namespace.

...

The META-INF/MANIFEST.MF file should contain the following entry for the client to run.

XML
Code Block
XML
borderStylesolid
titleMANIFEST.MF
Manifest-Version: 1.0
Main-Class: examples.appclient.client.ConverterClient

...

The following command illustrates the packaging.

No Format

...

...

borderStylesolid

C:\temp\ConverterEJBClient>jar -cvf ConverterEJBClient.jar *
added manifest
adding: examples/(in = 0) (out= 0)(stored 0%)
adding: examples/appclient/(in = 0) (out= 0)(stored 0%)
adding: examples/appclient/client/(in = 0) (out= 0)(stored 0%)
adding: examples/appclient/client/ConverterClient.class(in = 1716) (out= 936)(deflated 45%)
adding: examples/appclient/Converter.class(in = 146) (out= 131)(deflated 10%)
adding: META-INF/application-client.xml(in = 510) (out= 252)(deflated 50%)
adding: META-INF/geronimo-application-client.xml(in = 2049) (out= 474)(deflated 76%)
ignoring entry META-INF/MANIFEST.MF

The following commands illustrates the deployment and running of the client module.

No Format

...

borderStylesolid

C:\\Geronimo-2.1\bin>deploy.bat --user system --password manager deploy C:\temp\ConverterEJBClient.jar
Using GERONIMO_BASE:   C:\Geronimo-2.1
Using GERONIMO_HOME:   C:\Geronimo-2.1
Using GERONIMO_TMPDIR: var\temp
Using JRE_HOME:        C:\JDK\jre
    Deployed Converter/Converter-app-client-server/3.0/jar

C:\Geronimo-2.1\bin>java -Djava.endorsed.dirs="C:\Geronimo-2.1\lib\endorsed" -jar
              C:\Geronimo-2.1\bin\client.jar Converter/Converter-app-client/3.0/jar 4000

Rs 4000.0 is 100.0 Dollars.