You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Daliso Zuze <dz...@unam.na> on 2002/08/03 10:51:24 UTC

Servlet directory

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???

Re: Servlet directory

Posted by Daliso Zuze <dz...@unam.na>.
Yes Micheal, I have added those entries When I try to use the servlet
mapping name it gives me a CLASS NOT FOUND exception.


----- Original Message -----
From: "Michael E. Locasto" <lo...@cs.columbia.edu>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Cc: <dz...@unam.na>
Sent: Saturday, August 03, 2002 2:44 PM
Subject: Re: Servlet directory


> And you've provided appropriate <servelet> and <servlet-mapping> entries
in
> your web.xml?
>
> -Michael
>
> ----- Original Message -----
> From: "Daliso Zuze" <dz...@unam.na>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Saturday, August 03, 2002 4:51 AM
> Subject: Servlet directory
>
>
> 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???
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Servlet directory

Posted by "Michael E. Locasto" <lo...@cs.columbia.edu>.
And you've provided appropriate <servelet> and <servlet-mapping> entries in
your web.xml?

-Michael

----- Original Message -----
From: "Daliso Zuze" <dz...@unam.na>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Saturday, August 03, 2002 4:51 AM
Subject: Servlet directory


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???



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Servlet directory

Posted by Daliso Zuze <dz...@unam.na>.
Thanks, I got it working now, I had misplaced the classes directory.

Daliso

----- Original Message -----
From: "Jacob Kjome" <ho...@visi.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Saturday, August 03, 2002 7:18 PM
Subject: Re: Servlet directory


> 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???
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Servlet directory

Posted by Jacob Kjome <ho...@visi.com>.
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???