The way you are trying to access this servlet implies a couple of assumptions:

1.  Your servlet is in the default package.  That is to say that it exist 
in WEB-INF/classes and not some directory deeper inside of that.

2.  Your class is all lower case "myservlet" since that is how it is 
written on the URL your provided below.

I think it is probably likely that #1 is true.  However, I'm guessing that 
#2 is not.  The general practice for naming classes is to use Capital 
letters for each distinct part of the class name.  For instance, you 
probably named your class "MyServlet", not "myservlet".  As such, the URL 
you provided won't work.  It should be:

http://localhost:8080/myapp/servlet/MyServlet

Note that <servlet> and <servlet-mapping> entries in your own web.xml have 
nothing in particular to do with accessing your class through Tomcat's 
default servlet invoker which is mapped to /[your context]/servlet/*.

The other thing you should look at is that the directory that your app is 
running out of exists in:

"$TOMCAT_HOME/webapps/myapp"

make sure that "myapp" is in all lower case.


Oh, and make sure that there are no spaces in $TOMCAT_HOME.  If you have it 
installed in a directory like "Program Files", you can do the following (on 
Windows).  I'll use my setup as an example.

$CATALINA_HOME=C:\Progra~1\Apache~1\Jakarta\tomcat-4.1.8

The original path is:
C:\Program Files\Apache Group\Jakarta\tomcat-4.1.8

Just use the tilde's to fix directory names which have spaces.  The names 
with tilde's can be no more than 8 chars long.

Restart Tomcat after using the hints above and things should work just fine.

Jake


At 10:51 AM 8/3/2002 +0200, you wrote:
>I have put some servlet classes in my web applications classes directory, 
>however when I try to access it via the url 
>http://localhost:8080/myapp/servlet/myservlet it does not work. It seems 
>to only work when I put the classes in the default ROOT web app and access 
>it via http://localhost:8080/servlet/myservlet.
>
>Is there a way of configuring tomcat to make it work from the first url???

Reply via email to