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

tomcat can't find servlet

ricky gonzalez
Ranch Hand

Joined: Jun 30, 2000
Posts: 167
Hi, I made a simple servlet call SomeServlet and placed its class file in c:\tomcat\webapps\test\Web-inf\classes, but when I called\SomeServlet, tomcat could not find it.
Can anyone please help me?
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Tomcat follows Servlet 2.2 spec in which the directory structure of a web application is standardized. Frank already posted it here. Please take a look at it. There are 2 ways to invoke a servlet from a browser.
1. with alias http://localhost:8080/test/SomeServlet
2. the standard way of http://localhost:8080/test/servlet/SomeServlet
In the first case you have to add an alias in the '...\test\WEB-info\web.xml' file like this.
I prefer the 2nd standard way for simple servlets which are not inside a loooooong package so that we can just type http://localhost:8080/test/servlet/SomeServlet like that.
Try to call this way. Tomcat will surely be able to call the servlet. Also please note that the url which we type in the browser address bar is case-sensitive. 'someServlet' is different from 'SomeServlet'
maha anna

[This message has been edited by maha anna (edited October 15, 2000).]
ricky gonzalez
Ranch Hand

Joined: Jun 30, 2000
Posts: 167
Thank you so much maha!!
I agree. Here's the link:
subject: tomcat can't find servlet
It's not a secret anymore!