[jboss-user] [Beginners Corner] - Error deploying simple servlet

Andy00 do-not-reply at jboss.com
Sun Jul 12 10:31:21 EDT 2009


Hi all, 
I have just installed jboss 5.1.0.GA and set it as a server in eclipse (in which I also installed the jboss tools). I made a new web project and wrote a simple servlet, only to see if it is all ok, but the response of jboos when I called my servlet was an exception report:

javax.servlet.ServletException: non-HTTP request or response
	javax.servlet.http.HttpServlet.service(HttpServlet.java:845)
	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


The code of my servlet is:


  | package coreservlets;
  | 
  | import java.io.*;
  | import javax.servlet.ServletException;
  | import javax.servlet.http.HttpServletRequest;
  | import javax.servlet.http.HttpServletResponse;
  | 
  | 
  |  public class MiaServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
  |    static final long serialVersionUID = 1L;   	
  | 	
  | 	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  | 		PrintWriter out = response.getWriter();
  | 		out.println("Hello");
  | 	}  	
  | 	
  | 	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  | 		
  | 	}   	  	    
  | }
  | 


The web.xml is:


  | <?xml version="1.0" encoding="UTF-8"?>
  | <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  |   <display-name>test</display-name>
  |   <welcome-file-list>
  |     <welcome-file>index.html</welcome-file>
  |     <welcome-file>index.htm</welcome-file>
  |     <welcome-file>index.jsp</welcome-file>
  |     <welcome-file>default.html</welcome-file>
  |     <welcome-file>default.htm</welcome-file>
  |     <welcome-file>default.jsp</welcome-file>
  |   </welcome-file-list>
  |   <servlet>
  |     <description></description>
  |     <display-name>MiaServlet</display-name>
  |     <servlet-name>MiaServlet</servlet-name>
  |     <servlet-class>coreservlets.MiaServlet</servlet-class>
  |   </servlet>
  |   <servlet-mapping>
  |     <servlet-name>MiaServlet</servlet-name>
  |     <url-pattern>/MiaServlet</url-pattern>
  |   </servlet-mapping>
  | </web-app>
  | 


What could be the problem?

Another little question: in eclipse do I have to re-export the project as a war file and put it in deploy dir ALL THE TIME? Is there a faster method to test the web app?

Thanks


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

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



More information about the jboss-user mailing list