Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

This application defines a datasource with the help of the geronimo plan and web.xml deployment plans. The Geronimo plan from inventory-jetty or inventory-tomcat links the internal JNDI name "java:comp/env/jdbc/InventoryDS" to the sample database.

Code Block
xml
xml
borderStylesolid
titlegeronimo-web.xml
borderStylesolid
xml
<?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>org.apache.geronimo.samples</dep:groupId>
      <dep:artifactId>inventory-jetty</dep:artifactId>
      <dep:version>2.2-SNAPSHOT</dep:version>
      <dep:type>car</dep:type>
    </dep:moduleId>
    <dep:dependencies>
      <dep:dependency>
        <dep:groupId>org.apache.geronimo.configs</dep:groupId>
        <dep:artifactId>jasper</dep:artifactId>
        <dep:version>2.2-SNAPSHOT</dep:version>
        <dep:type>car</dep:type>
      </dep:dependency>
      <dep:dependency>
        <dep:groupId>org.apache.geronimo.configs</dep:groupId>
        <dep:artifactId>jetty6</dep:artifactId>
        <dep:version>2.2-SNAPSHOT</dep:version>
        <dep:type>car</dep:type>
      </dep:dependency>
      <dep:dependency>
        <dep:groupId>org.apache.geronimo.samples</dep:groupId>
        <dep:artifactId>sample-datasource</dep:artifactId>
        <dep:version>2.2-SNAPSHOT</dep:version>
        <dep:type>car</dep:type>
      </dep:dependency>
    </dep:dependencies>
    <dep:hidden-classes/>
    <dep:non-overridable-classes/>
  </dep:environment>
  <context-root>/inventory</context-root>
  <!--define a reference name to the db pool-->
  <resource-ref>
    <ref-name>jdbc/InventoryDS</ref-name>
    <resource-link>SampleTxDatasource</resource-link>
  </resource-ref>
</web-app>

Following is the web.xml of the Inventory application. It declares the name "java:comp/env/jdbc/InventoryDS" used in ItemDAO to lookup the datasource.

Code Block
xml
titleweb.xml
borderStylesolid
titleweb.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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/web-app_2_4.xsd"
         version="2.4">

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

    <servlet>
        <display-name>AddItemServlet</display-name>
        <servlet-name>AddItemServlet</servlet-name>
        <servlet-class>org.apache.geronimo.samples.inventory.web.AddItemServlet</servlet-class>
    </servlet>
    <servlet>
        <display-name>IssueingServlet</display-name>
        <servlet-name>IssueingServlet</servlet-name>
        <servlet-class>org.apache.geronimo.samples.inventory.web.IssueingServlet</servlet-class>
    </servlet>
    <servlet>
        <display-name>ReceivingServlet</display-name>
        <servlet-name>ReceivingServlet</servlet-name>
        <servlet-class>org.apache.geronimo.samples.inventory.web.ReceivingServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>AddItemServlet</servlet-name>
        <url-pattern>/add_item</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>IssueingServlet</servlet-name>
        <url-pattern>/issue</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>ReceivingServlet</servlet-name>
        <url-pattern>/recv</url-pattern>
    </servlet-mapping>

    <!-- reference name exposed as a datasource -->
    <resource-ref>
        <res-ref-name>jdbc/InventoryDS</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>

...