...
In the following screen, the wizard would have identified all WAR references that need to be resolved. The references listed on this screen are specific to this application. The JDBCRef column is showing the resource name defined in ListCustomers.java
. See @Resource(name = "jdbc/MyDataSource")
from the excerpt above.
As mentioned earlier, for this example we created a database connection pool we called BankDB_Pool. From the JDBC Pools pull-down menu you can now select the appropriate connection pool and click Next.
The following screen list all available modules and allows you specify the modules this WAR has dependencies on. This screen also provides a default selection, in this case the database connection pool will be already selected. Accept the default and click Next. For most scenarios the default values should be sufficient.
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.
...
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: No Format
WebAppEjbAccessAnnotations.war
includes a Servlet and a JSP. The following excerpt shows the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application.
Code Block | ||||||
---|---|---|---|---|---|---|
|
...
Component Name State
default/CurrencyConverterEJB/1199743733609/jar running
| ||
...
public class ConverterHandler extends javax.servlet.http.HttpServlet implements
javax.servlet.Servlet {
@EJB(name = "ejb/Converter")
private Converter converter;
...
|
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.
In the following screen, the wizard would have identified all WAR references that need to be resolved. The references listed on this screen are specific to this application. The EJBRef column is showing the resource name defined in ConverterHandler.java
. See @EJB(name = "ejb/Converter")
from the excerpt above.
From the EJBs Deployed pull-down menu select the JAR you deployed earlier ConverterBean (default/CurrencyConverterEJB/1199743733609/jar)
and click Next.
The following screen list all available modules and allows you specify additional modules this WAR has dependencies on. This screen also provides a default selection, in this case the EJB JAR you deployed previously will be already selected. Accept the default and click Next. For most scenarios the default values should be sufficient.
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.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1" |
WebAppEjbAccessAnnotations.war
includes a Servlet and a JSP. The following excerpt shows the annotation part the wizard has identified and will likely be prompting for additional information while deploying the application.
...
...
public class ConverterHandler extends javax.servlet.http.HttpServlet implements
javax.servlet.Servlet {
@EJB(name = "ejb/Converter")
private Converter converter;
...
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.
In the following screen, the wizard would have identified all WAR references that need to be resolved. The references listed on this screen are specific to this application. The EJBRef column is showing the resource name defined in ConverterHandler.java
. See @EJB(name = "ejb/Converter")
from the excerpt above.
From the EJBs Deployed pull-down menu select the JAR you deployed earlier ConverterBean (default/CurrencyConverterEJB/1199743733609/jar)
and click Next.
The following screen list all available modules and allows you specify additional modules this WAR has dependencies on. This screen also provides a default selection, in this case the EJB JAR you deployed previously will be already selected. Accept the default and click Next. For most scenarios the default values should be sufficient.
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.
Code Block | |
---|---|
xml | xml |
borderStyle | solid |
title | Generated deployment plan | <?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>1199743733609<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>1199743733609<version>1199912901187</nam:version> <nam:name>ConverterBean</nam:name> </nam:pattern> </nam:ejb-ref> </web-app> |
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?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>WebAppJMSAccessAnnotations</dep:artifactId> <dep:version>1.0</dep:version> <dep:type>war</dep:type> </dep:moduleId> <dep:dependencies> <dep:dependency> <dep:groupId>org.apache.geronimo.configs</dep:groupId> <dep:artifactId>activemq-ra</dep:artifactId> <dep:version>2.1-SNAPSHOT</dep:version> <dep:type>car</dep:type> </dep:dependency> </dep:dependencies> </dep:environment> <context-root>WebAppJMSAccessAnnotations</context-root> <nam:resource-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2"> <nam:ref-name>jms/TestConnectionFactory</nam:ref-name> <nam:pattern> <nam:groupId>org.apache.geronimo.configs</nam:groupId> <nam:artifactId>activemq-ra</nam:artifactId> <nam:version>2.1-SNAPSHOT</nam:version> <nam:name>DefaultActiveMQConnectionFactory</nam:name> </nam:pattern> </nam:resource-ref> <nam:resource-env-ref xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2"> <nam:ref-name>jms/TestQueue</nam:ref-name> <nam:pattern> <nam:groupId>org.apache.geronimo.configs</nam:groupId> <nam:artifactId>activemq-ra</nam:artifactId> <nam:version>2.1-SNAPSHOT</nam:version> <nam:name>MDBTransferBeanOutQueue</nam:name> </nam:pattern> </nam:resource-env-ref> </web-app> |
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.
...
</nam:pattern>
</nam:resource-env-ref>
</web-app>
|
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.
So far we have shown you how easy is to deploy a web application when using annotations. The following section focuses on applications not using annotations, this is mainly for applications based on the previous J2EE specification.
Sample without annotations
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.
Attachments
Attachments | ||
---|---|---|
|