[jboss-user] [Beginner's Corner] - Deploying Simple Servlet

dontocsata do-not-reply at jboss.com
Sat Aug 29 19:38:11 EDT 2009


Hello all, I am new to Java Enterprise, Servlets, and JBoss (learning for a job).

I jave jboss 4.2.3, running up fine.

I have a simple HelloWorld Servlet (code below).  How do I deploy this on jBoss?  I made a folder WEB-INF with a web.xml containing:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
  |          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |          xsi:schemaLocation="http:/java.sun.com/dtd/web-app_2_3.dtd">
  |   <servlet>
  |     <servlet-name>hello</servlet-name>
  |     <servlet-class>test.HelloServlet</servlet-class>
  |   </servlet>
  | 
  |   <servlet-mapping>
  |     <servlet-name>hello</servlet-name>
  |     <url-pattern>/hello</url-pattern>
  |   </servlet-mapping>
  | </web-app>

I put my web-inf folder into the deploy folder and it fails to deploy it, it says the state for each file is 'INIT_WAITING_DEPLOYER'.

How do I actually get this servlet to run?

Folder Structure:
WEB-INF/web.xml
WEB-INF/classes/test/HelloServlet.class

CODE:
package test;
  | 
  | import java.io.*;
  | 
  | import javax.servlet.http.*;
  | import javax.servlet.*;
  | 
  | public class HelloServlet extends HttpServlet {
  |   public void doGet (HttpServletRequest req,
  |                      HttpServletResponse res)
  |     throws ServletException, IOException
  |   {
  |     PrintWriter out = res.getWriter();
  | 
  |     out.println("Hello, world!");
  |     out.close();
  |   }
  | }
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4252462#4252462

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4252462



More information about the jboss-user mailing list