aspose file tools*
The moose likes Servlets and the fly likes I can't believe, I'm not able to get this servlet working! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "I can Watch "I can New topic
Author

I can't believe, I'm not able to get this servlet working!

Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
Hi folks,
I've created a Context RnD which has been added in jakarta-tomcata\conf\server.xml too.
i have the following directory structure:
webapps
|
RnD
|
WEB-INF
|
classes\TestServlet.class

when i do this, http://localhost:8080/RnD/servlet/TestServlet
it give me the following error..
HTTP Status 404 - /RnD/servlet/TestServlet
what's wrong with it?
but when i put this class in examples (the context creted by tomcat for examples) and do this
http://localhost:8080/examples/servlet/TestServlet, it works.
could you please point out what am i doing wrong here?
thanks.
[ October 24, 2002: Message edited by: Himal Chuli ]
[ October 24, 2002: Message edited by: Himal Chuli ]
[ October 24, 2002: Message edited by: Himal Chuli ]

Himal
Allan Hope
Greenhorn

Joined: Oct 29, 2001
Posts: 2
Could it be that your directory is named Rnd but is referenced as RnD elsewhere.
Christopher Dixon
Greenhorn

Joined: Jan 30, 2002
Posts: 22
Does it serve static content, or JSP, from /RnD/ ?
If so, the only thing I could suggest would be double check the declaration in server.xml. It has to be well formed, since you didn't say anything about xerces exceptions in the log. Also try cranking up the logging (debug) level for the container and/or context. Please let us know what you find!
Chris
Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
hi christphor,
yes, it does serve the following jsp page
webapps\RnD\jsp\hello.jsp
so http://localhost:8080/RnD/jsp/hello.jsp brings that hello.jsp page. no problem.
Also when i mapped the TestServlet in web.xml and do this
http://localhost:8080/RnD/TestServlet it works.
it just does not work without mapping. (my TestServlet is here)
webapps/RnD/WEB-INF/classes/TestServlet.class
So without mapping, when i do following
http://localhost:8080/RnD/servlet/TestServlet then
gives me error. i don't know why. very goofy!
give me some idea what went wrong here with it.
thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12805
    
    5
Once again it is shown that not putting your servlet class in a package leads to weird behaviour.
Bill
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

But why worry at all?? Mapping your servlets is GOOD. Using the servlet/* 'default unsecure mapping' is BAD.

p.s. -> In Tomcat 4.1.12 and above, the servlet/* mapping is removed by default.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: I can't believe, I'm not able to get this servlet working!