Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

problems running servlet with jboss

843841Aug 23 2006 — edited Aug 28 2006
Hi everybody,

I'm using Jboss 3.2.5 and I need to run a servlet inside Jboss. Next I'm going to describe the steps that I follow to make the servlet with IDE Eclipse 3.1. Also I have Jboss IDE inside eclipse.

First I create a java project
-Inside it, I have created the two folders for source and class (src and bin)
-Next I create inside src the folder WEB-INF that include my package:
com.devx.example

src
\
-------- com.devx.example
\ \
\ HelloWorldServlet.java
\
\
--------WEB-INF
\
web.xml


Now I write the code of the file HelloWorldServlet.java and web.xml
package com.devx.example;
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloWorldServlet extends HttpServlet
{	

               protected void service(HttpServletRequest request, HttpServletResponse response)		
                           throws ServletException, IOException	
    {		
                           ServletOutputStream out = response.getOutputStream();		
                           out.println("<html><body><h1>Hello World!</h1></body></html>");	
    }
}

*****************************************************************************

<!DOCTYPE web-app PUBLIC
 	'-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN'
	'http://java.sun.com/j2ee/dtds/web-app_2.2.dtd'>
<web-app>
		<servlet>
		<servlet-name>HelloWorldServlet</servlet-name>
		<servlet-class>com.devx.example.HelloWorldServlet</servlet-class>
	</servlet>
		<servlet-mapping>
		<servlet-name>HelloWorldServlet</servlet-name>
		<url-pattern>/Hello</url-pattern>
	</servlet-mapping>
</web-app>
then i go to packaging configuration and generate the .war. When I'm on this point appears the following options:

HelloWorld/src/WEB-INF/web.xml ->WEB-INF
HelloWorld/src/WEB-INF/jboss-web.xml ->WEB-INF
HelloWorld/bin ->WEB-INF/classes

/HelloWorld/src/META-INF/MANIFEST.MF // I suprime this line

After that it generates a file named packaging-build.xml. Then I run the packaging and appears the helloworld.war

Finally the deploy:
--- Deploy to: Jboss3.2.5

Now in the web browser I go to : http://localhost:8080/helloworld/Hello

My problem is that i can't see anything when I go to this last URL. Can somebody help me with this or say me another method for execute servlets and jsp

Thanks for all
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 25 2006
Added on Aug 23 2006
22 comments
301 views