...
On the Archive: field browse to the CurrencyConverterEJB.jar
file you just extracted and click "Install", this will install and start the JAR. You can verify the status of this JAR by clicking on EJB JARs link from the menu on the left. It should display something like this:
...
This is basically the same sample application we used in the Sample with annotations section, but obviously without annotations. Once again for this exsample example we created a sample database and a connection pool. However, the emphasis of this section is on the web.xml file which contains the resource reference required for this application to run.
...
WebAppJDBCAccess.war
includes a Servlet and , a JSP and web.xml
. The following sample shows the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application. In illustrates the web.xml
, in this example the Plan Creator wizard will look into the <resource-ref>
section.
...
Section |
---|
Column |
---|
| Code Block |
---|
| xml |
---|
| xml |
---|
borderStyle | solid |
---|
title | Generated deployment plan without Annotations |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppJDBCAccess</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>console.dbpool</dep:groupId>
<dep:artifactId>BankDB_Pool</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>rar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppJDBCAccess</context-root>
<nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jdbc/MyDataSource</nam:ref-name>
<nam:pattern>
<nam:groupId>console.dbpool</nam:groupId>
<nam:artifactId>BankDB_Pool</nam:artifactId>
<nam:version>1.0</nam:version>
<nam:name>BankDB_Pool</nam:name>
</nam:pattern>
</nam:resource-ref>
</web-app>
|
|
Column |
---|
| Code Block |
---|
| xml |
---|
| xml |
---|
borderStyle | solid |
---|
title | Generated deployment plan with Annotations |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppJDBCAccessAnnotations</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>console.dbpool</dep:groupId>
<dep:artifactId>BankDB_Pool</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>rar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppJDBCAccessAnnotations</context-root>
<nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>jdbc/MyDataSource</nam:ref-name>
<nam:pattern>
<nam:groupId>console.dbpool</nam:groupId>
<nam:artifactId>BankDB_Pool</nam:artifactId>
<nam:version>1.0</nam:version>
<nam:name>BankDB_Pool</nam:name>
</nam:pattern>
</nam:resource-ref>
</web-app>
|
|
|
EJB access
...
This example is based on the same sample application we used in the Sample with annotations section but without annotations. In the #Attachments section we have included all the files you need to test the deployment of this sample application.
The noAnnotations-TestEJBAccess.zip file provides the CurrencyConverterEJB.jar
that needs to be deployed first, the WebAppEjbAccess.war
which is the WAR we will be deploying and a sample of the generated deployment plan generatedPlan.xml
. Download and extract the zip file to a directory of your convenience.
WebAppEjbAccess.war
includes a Servlet and the web.xml
. In the annotations example we provided a servlet as well but for this sample all the processing is done directly by the JSP. The following sample illustrates the web.xml
, in this example the Plan Creator wizard will look into the <resource-ref>
section.
Code Block |
---|
| xml |
---|
| xml |
---|
borderStyle | solid |
---|
title | web.xml |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5"
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/web-app_2_5.xsd">
<ejb-ref>
<ejb-ref-name>ejb/Converter</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<remote>myPackage.Converter</remote>
</ejb-ref>
</web-app>
|
WebAppEjbAccess.war
requires you deploy the EJB JAR first. If you have not done some while testing the annotation samples make sure you deploy it now. With the server up and running access the Geronimo Administration Console with a web browser and click on Deploy New on the left menu. On the Archive: field browse to the CurrencyConverterEJB.jar
file you just extracted and click Install, this will install and start the JAR.
After you installed the required EJB JAR click on Plan Creator on the left menu. Browse to the WebAppEjbAccess.war
you just extracted and click on Configure. The subsequent configuration pages are identical to what we described in the Sample with annotations section so we will skip the step-by-steps details. The end result is the same, the Plan Creator wizard has generated the deployment plan directly from the provided web.xml. To facilitate comparison we are providing both generated deployment plans side-by-side, note that only the <artifactId>
and <context-root>
are different in order to make these applications unique when deployed on the same server.
Section |
---|
Column |
---|
| Code Block |
---|
| xml |
---|
| xml |
---|
borderStyle | solid |
---|
title | Generated deployment plan without Annotations |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppEjbAccess</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>default</dep:groupId>
<dep:artifactId>CurrencyConverterEJB</dep:artifactId>
<dep:version>1199912901187</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppEjbAccess</context-root>
<nam:ejb-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>ejb/Converter</nam:ref-name>
<nam:pattern>
<nam:groupId>default</nam:groupId>
<nam:artifactId>CurrencyConverterEJB</nam:artifactId>
<nam:version>1199912901187</nam:version>
<nam:name>ConverterBean</nam:name>
</nam:pattern>
</nam:ejb-ref>
</web-app>
|
|
Column |
---|
| Code Block |
---|
| xml |
---|
| xml |
---|
borderStyle | solid |
---|
title | Generated deployment plan with Annotations |
---|
|
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>default</dep:groupId>
<dep:artifactId>WebAppEjbAccessAnnotations</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>default</dep:groupId>
<dep:artifactId>CurrencyConverterEJB</dep:artifactId>
<dep:version>1199912901187</dep:version>
<dep:type>jar</dep:type>
</dep:dependency>
</dep:dependencies>
</dep:environment>
<context-root>WebAppEjbAccessAnnotations</context-root>
<nam:ejb-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
<nam:ref-name>ejb/Converter</nam:ref-name>
<nam:pattern>
<nam:groupId>default</nam:groupId>
<nam:artifactId>CurrencyConverterEJB</nam:artifactId>
<nam:version>1199912901187</nam:version>
<nam:name>ConverterBean</nam:name>
</nam:pattern>
</nam:ejb-ref>
</web-app>
|
|
|
...