• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

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

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could it be that your directory is named Rnd but is referenced as RnD elsewhere.
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once again it is shown that not putting your servlet class in a package leads to weird behaviour.
Bill
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic