Deploying Hello World Application on Apache Geronimo Application Server
In this section we will develop Hello World JSP
application and test on the Apache Geronimo Application Server.
Please follow the following steps to easily develop and
deploy the application on the server.
Step 1:
Create the following directory structure in a directory
to place the application artifacts correctly
| Directory
Structure of Web Component |
| /hello/ |
|
HelloWorld.jsp |
WEB-ING |
| |
web.xml |
|
geronimo-web.xml |
| |
classes |
| |
servlet classes |
| |
lib |
| |
jar files |
| |
|
Here is the screen shot of directories that you need to
create:

Alternately you can download the code and directory structure from following
url:

Step 2:
Create jsp file under hello directory and add the following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Hello World Jsp Example</TITLE>
</HEAD>
<BODY>
<h1>Hello World!</h1>
<p><%=new java.util.Date()%></p>
</BODY>
</HTML>
|
|
Step 3:
Create geronimo-web.xml file into /hello/WEB-INF/ directory and copy the
following code:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<environment>
<moduleId>
<groupId>org.apache.geronimo.samples</groupId>
<artifactId>HelloWorldApp</artifactId>
<version>2.1</version>
<type>war</type>
</moduleId>
</environment>
<context-root>/hello</context-root>
</web-app>
|
Step 4:
Finally we have to create the web.xml file into /hello/WEB-INF/ directory
with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 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">
<welcome-file-list>
<welcome-file>HelloWorld.jsp</welcome-file>
</welcome-file-list>
</web-app>
|
Step 5:
To create the deployable war file use the following command:
jar -cvf ../hello.war *
Here the output
C:\gerionimo\HelloWorldJsp\hello>jar -cvf ../hello.war *
added manifest
adding: HelloWorld.jsp(in = 222) (out= 166)(deflated 25%)
adding: WEB-INF/(in = 0) (out= 0)(stored 0%)
adding: WEB-INF/classes/(in = 0) (out= 0)(stored 0%)
adding: WEB-INF/geronimo-web.xml(in = 430) (out= 228)(deflated 46%)
adding: WEB-INF/lib/(in = 0) (out= 0)(stored 0%)
adding: WEB-INF/web.xml(in = 430) (out= 223)(deflated 48%)
C:\gerionimo\HelloWorldJsp\hello> |
Step 6:
Now we are ready to deploy the application. To deploy the application copy
hello.war into deploy directory of the Apache Geronimo application server (into
directory C:\geronimo-tomcat6-javaee5-2.1\deploy).
Application server will auto deploy the application.
Step 7:
Open the browser and type http://localhost:8080/hello/.
Your browser should show the Hello World message with the current date as shown
below:

Download the source code of the application

In the next section we will deploy Servlet on the
Apache Geronimo Application server.
|
Current Comments
0 comments so far (post your own) View All Comments Latest 10 Comments: