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

...

To facilitate the creation of Geronimo-specific deployment plans there is a new portlet now available. excerptINLINE

The Plan Creator wizard available from the Geronimo Administration Console makes deployment easier by walking you through a sequence of steps to auto-generate the geronimo-web.xml for a given WAR file.

The wizard searches the references declared in the web.xml as well as what is now defined within the code itself via annotations. Depending on the type of application the Plan Creator wizard will present a series of pages requesting specific information to resolve the references and dependencies. The wizard also offers default values which work for most of the configurations.

...

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 jdbcjdbc

This sample is a very simple database access application that uses annotations. For this example we have created a sample BankDB database on the embedded Derby as well as a database connection pool. Although we will not be covering in this section how to create a database or a connection pool we still provide in the #Attachments section some SQL sample to generate the required sample database.

...

WebAppJDBCAccessAnnotations.war includes a Servlet, a JSP and a basic web.xml. The following excerpt shows the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application.

...

...

With the server up and running access the Geronimo Administration Console with a Web browser and click on Plan Creator on the left menu.

...

The final configuration page displays the generated deployment plan and allows you to make any additional editing. The following example shows the generated deployment plan.

...

The last step is to actually deploy and start the application, click on Deploy WAR.

You should receive two confirmation messages stating the application was successfully deployed and successfully started. The Launch Web App link takes your browser directly to the application you just deployed based on the context root you defined earlier. The Finish link takes you to the Plan Creator portlet again to start deploying a new application.

EJB access Anchor ejbejb

This sample is a simple Web application that accesses a Session EJB. It requires a JAR to be deployed before you can deploy the Web application. In the #Attachments section we have included all the files you need to test the deployment of this sample application.

...

WebAppEjbAccessAnnotations.war includes a Servlet, a JSP and a basic web.xml. The following excerpt shows the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application.

...

With the prerequisite JAR just installed click on Plan Creator on the left menu to proceed with the WAR installation. Browse to the WebAppEjbAccessAnnotations.war you just extracted and click on Configure. In the resulting screen you will be configuring the Web application identity. You may want to change the default proposed values however, for this example, we will be accepting the defaults. Click Next.

...

The final configuration page displays the generated deployment plan and allows you to make any additional editing. The following example shows the generated deployment plan.

...

...

The last step is to actually deploy and start the application, click on Deploy WAR.

You should receive two confirmation messages stating the application was successfully deployed and successfully started. The Launch Web App link takes your browser directly to the application you just deployed based on the context root you defined earlier. Finish takes you to the Plan Creator portlet again to start deploying a new application.

JMS access Anchor jmsjms

This is a simple Web application that accesses a JMS Connection Factory and a JMS destination. Producer servlet sends 5 messages to a JMS queue and the Consumer servlet synchronously receives messages from the same queue.

...

WebAppJMSAccessAnnotations.war includes the two Servlets mentioned above, a JSP and a basic web.xml. The following excerpts show the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application.

...

With the server up and running access the Geronimo Administration Console with a web browser and click on Plan Creator on the left menu.

...

The final configuration page displays the generated deployment plan and allows you to make any additional editing. The following example shows the generated deployment plan.

...

The last step is to actually deploy and start the application, click on Deploy WAR.

...

Sample without annotations Anchor noannotationsnoannotations

To make it easier to compare we are providing a similar set of applications as in the previous section(JDBC, EJB and JMS) but without the advantage of using annotations. In addition we are also including a security configuration application to cover the additional functionality we didn't cover in the previous section.

JDBC access Anchorjdbc2jdbc2

This is basically the same sample application we used in the Sample with annotations section, but obviously without annotations. Once again for this 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, a JSP and web.xml. The following sample illustrates the web.xml, in this example the Plan Creator wizard will look into the <resource-ref> section.

...

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.

...

EJB access Anchor ejb2ejb2

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.

...

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 <ejb-ref> section.

...

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.

...

...

JMS access Anchorjms2jms2

Once again we are basing this sample application from the one we used in the annotations section. There is a Producer servlet that sends 5 messages to a JMS queue and a Consumer servlet that synchronously receives messages from the same queue.

...

WebAppJMSAccess.war includes the two Servlets mentioned above, a JSP and the web.xml. The following sample illustrates the web.xml, in this example the Plan Creator wizard will look into the <resource-ref>,<message-destination-ref> and <message-destination> sections.

...

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 WebAppJMSAccess.war you just extracted and click on Configure. The subsequent configuration pages are nearly 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.

Once again we are providing both generated deployment plans side-by-side to facilitate comparison. These two sample applications are slightly different so you can see some additional variations in the generated deployment plan.

...

Security configuration Anchorsecurity2security2

This sample application is a basic time reporting system that uses Servlets, JSPs and Java EE declarative security. In addition to above features it uses Geronimo's embedded Derby database to store user information of the system. Even though this application uses a database to hold user information, it is merely for configuration purposes. This sample application is a slight variation from the one covered in Geronimo v2.0 Documentation. The focus of this document is on the Plan Creator wizard so we will not cover in much detail this application's inner working, please refer to Web application security sample for further details.

...

Now that we have configured the environment we go back to the application. timereport.war provides 2 Servlets, several JSPs and the web.xml we will be focusing on. In addition this WAR contains the sources and full java docs. The following sample illustrates the web.xml, here are defined all the security constraints, realms and roles the Plan Creator wizard will use to generate the Geronimo specific deployment plan.

...

...

  1. Back in the Geronimo Administration Console click on Plan Creator. Browse to the timereport.war you just extracted and click on Configure.



  2. In the resulting screen you will be configuring the web application identity. You may want to change the default proposed values however, for this example, we will be accepting the defaults. Click Next.



  3. As a difference from the other sample applications, for this example we do not have to resolve any resource references so the wizard will jump directly to the security part of the configuration. In the resulting screen define the security configuration.
    1. Select TimeReportRealm from the Security Realm Name: pull down menu. This is the security realm you deployed earlier.
    2. For security role employee select Add -> Principal from the pull down menu and add 2 Group Prinicipals with name EmployeeGroup and ManagerGroup.
    3. For security role manager, select Add -> Principal and add 1 Group Prinicipal with name ManagerGroup.



  4. Click Next, the following screen allows you to select WAR dependencies. This application has not dependencies on any these modules, click Next.
  5. In the Created Plan screen you should see a plan similar to this one. Code BlockxmlborderStylesolidtitleGenerated deployment plan without Annotationsxml <?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>timereport</dep:artifactId> <dep:version>1.0</dep:version> dep:version> <dep:type>war</dep:type> </dep:moduleId> </dep:environment> <context-root>timereport</context-root> <security-realm-name>TimeReportRealm</security-realm-name> <app:security xsi:type="sec:securityType" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0" xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <sec:role-mappings> <sec:role role-name="employee"> > <sec:principal name="EmployeeGroup" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/> <sec:principal name="ManagerGroup" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/> </sec:role> <sec:role role-name="manager"> <sec:principal name="ManagerGroup" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/> </sec:role> </sec:role-mappings> </app:security> </web-app>
  6. Click on Deploy WAR and then click on Launch Web App to run the sample application. Verify userid and password values from 1_TimeReportDB.sql.

Attachments

...

...