Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following sections provide sample applications with different features so you can better appreciate the wizard behavior.

Sample with annotations
Anchor
annotations
annotations

There are four simple applications attached to give you a better idea of how the plan creator wizard would work when deploying web applications.

...

JDBC access
Anchor
jdbc2
jdbc2

This is basically the same sample application we used in the Sample with annotations section, but obviously without annotations. Once again for this exsample 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.

The noAnnotations-TestJDBCAccess.zip file provides a BankDB.sql, WebAppJDBCAccess.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.

WebAppJDBCAccess.war includes a Servlet and a JSP. The following sample shows the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application. In this example the Plan Creator wizard will look into the <resource-ref> section.

Code Block
xml
xml
borderStylesolid
titleweb.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
	       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
	       id="WebApp_ID" version="2.5">
  <servlet>
    <description></description>
    <display-name>ListCustomers</display-name>
    <servlet-name>ListCustomers</servlet-name>
    <servlet-class>myPackage.ListCustomers</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ListCustomers</servlet-name>
    <url-pattern>/listCustomers</url-pattern>
  </servlet-mapping>
  <resource-ref>
  	<res-ref-name>jdbc/MyDataSource</res-ref-name>
  	<res-type>javax.sql.DataSource</res-type>
  	<res-auth>Container</res-auth>
  	<res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref>
</web-app>

With the server up and running access the Geronimo Administration Console with a web browser and click on Plan Creator on the left menu. Browse to the WebAppJDBCAccess.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
width50%
Code Block
xml
xml
borderStylesolid
titleGenerated 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
width50%
Code Block
xml
xml
borderStylesolid
titleGenerated 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
Anchor
ejb2
ejb2

JMS access
Anchor
jms2
jms2

...