Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
 
 
Search All Tutorials

 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 
Tutorials
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

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.

                         
Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

0 comments so far (post your own) View All Comments Latest 10 Comments:

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.