File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Weird Problem! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Weird Problem!" Watch "Weird Problem!" New topic

Weird Problem!

Himal Chuli
Ranch Hand

Joined: Aug 06, 2002
Posts: 118
hi folks,
i created a servlet and deployed in tomcat. when i do like this:
http://localhost:8080/myproject/servlet/Try, gives me the following error

i have a directory structure like this

i also checked a server.xml file and delcared myproject as servletcontext in that file in conf folder.
if i put Try.class in exmpales folder that's created when tomcat is installed, access like this
http://localhost:8080/examples/servlet/Try, works fine.
but why does not work while putting it in myproject? can someone explain me.

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
Seems like we get this one every couple of days.
You need to put your servlet in a package and create an entry for it in the web.xml for the myproject application. You can download the servlet API from which goes into great length about what goes where in the directorie and web.xml. Take a look at the web.xml files that Tomcat uses in examples and other places - there are lots of embedded comments.
I agree. Here's the link:
subject: Weird Problem!
It's not a secret anymore!