Results 1 to 2 of 2
Thread: Servlet mapping
- 04-04-2009, 08:46 AM #1
Member
- Join Date
- Apr 2009
- Posts
- 2
- Rep Power
- 0
Servlet mapping
Hello
I have tomcat 6.0 on windows xp , jdk 1.5
I made a simple servlet
/webapps/my/WEB-INF/web.xml :and the servlet class :Java Code:<web-app> <servlet> <servlet-name>my</servlet-name> <servlet-class>my.Servlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>my</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app>
/webapps/my/WEB-INF/classes/my/Servlet.java
I get from http:://localhost/my the following :Java Code:package my; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import java.io.PrintWriter; public class Servlet extends HttpServlet { PrintWriter out; public void doGet (HttpServletRequest rq, HttpServletResponse rs) throws java.io.IOException { doPost (rq,rs); } public void doPost (HttpServletRequest request, HttpServletResponse response) throws java.io.IOException { respond(request,response); } public void respond (HttpServletRequest request, HttpServletResponse response) throws java.io.IOException { out.print("testing"); } }
and the tomcat widow says :Java Code:java.lang.NullPointerException my.Servlet.respond(Servlet.java:22) my.Servlet.doPost(Servlet.java:17) my.Servlet.doGet(Servlet.java:13) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
I guess it cannot instantiate the my.Servlet but I have no ideea whyJava Code:INFO:Reloading context [/my] CONTAINER org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/my] has not been started
Last edited by cozsmin; 04-04-2009 at 08:49 AM.
- 04-04-2009, 09:15 AM #2
Member
- Join Date
- Apr 2009
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
xml mapping error with JPA in RAD, RSA
By ishakteyran in forum Other IDEsReplies: 0Last Post: 02-05-2009, 08:00 PM -
xml mapping error with JPA
By ishakteyran in forum XMLReplies: 0Last Post: 02-05-2009, 07:59 PM -
Help with image mapping
By coco in forum AWT / SwingReplies: 1Last Post: 08-07-2007, 04:06 AM -
About servlet-mapping
By Heather in forum Java ServletReplies: 1Last Post: 07-14-2007, 06:00 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks