You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Felix A. Milovanov" <fe...@terasystems.com> on 2001/04/02 20:57:01 UTC

404 handler in Tomcat.

  Hello all,

  I'm a new user in this mail-list, and I appologize if this question was 
already discussed in this list.

  I've a Tomcat working with Apache. I've configured Apache to handle 404 error
by /404.jsp :

	ErrorDocument 404 /404.jsp

  When I try to access non-existed resource ( like /foo.html ), this handler
works excellent. But when I try to access non-exised servlet ( something like
/servlet/foo )... I got a "404 Not found" message from Tomcat. And it looks
dramatically different from Apache's one :))

  How should I configure Tomcat to use Apache's error handler? 

  Sincerely yours,
									Felix.

RE: Should "tomcat-auto" do this?

Posted by Filip Hanik <ma...@filip.net>.
>So, my question is: shouldn't tomcat-auto also contain JkMount commands for
>all servlets that I've mapped to paths in web.xml?

nope, you have to set this up yourself

JkMount /tomcat-example/newserv ajp12

~
Namaste - I bow to the divine in you
~
Filip Hanik
Software Architect
filip@filip.net
www.filip.net

> -----Original Message-----
> From: Joe Emenaker [mailto:joe@emenaker.com]
> Sent: Monday, April 02, 2001 6:02 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Should "tomcat-auto" do this?
>
>
> When I run Tomcat, it auto-generates an include file for Apache called
> "tomcat-auto". It uses a directive called "JkMount" to redirect certain
> URL's to Tomcat's non-http interface. For example, my "tomcat-examples"
> webapp yields a couple of entries that look like:
>
>    JkMount /tomcat-examples/servlet/* ajp12
>    JkMount /tomcat-examples/*.jsp ajp12
>
> So that anything beginning with "/tomcat-examples/" and ending in
> ".jsp" or
> anything beginning with "/tomcat-examples/servlet" will get redirected to
> Tomcat.
>
> Okay.... fine. However, I can define other servlet mappings in the web.xml
> file that don't get reflected in tomcat-auto. For example,
> suppose I made a
> servlet called MyNewServlet.class and put it into tomcat-examples. Let's
> also suppose that I mapped that to the path "newserv" in my web.xml.
>
> If I do this, I can get to the servlet through Tomcat's HTTP port
> in one of
> two ways:
>   /tomcat-examples/servlet/MyNewServlet
> or
>   /tomcat-example/newserv
>
> However, going through *Apache*, I can only use the first one, because
> tomcat-auto tells Apache to only forward requests to Tomcat if it sees
> something ending in *.jsp or something with "servlet" in the path.
>
> So, my question is: shouldn't tomcat-auto also contain JkMount
> commands for
> all servlets that I've mapped to paths in web.xml?
>
> - Joe
>
>
>


Should "tomcat-auto" do this?

Posted by Joe Emenaker <jo...@emenaker.com>.
When I run Tomcat, it auto-generates an include file for Apache called
"tomcat-auto". It uses a directive called "JkMount" to redirect certain
URL's to Tomcat's non-http interface. For example, my "tomcat-examples"
webapp yields a couple of entries that look like:

   JkMount /tomcat-examples/servlet/* ajp12
   JkMount /tomcat-examples/*.jsp ajp12

So that anything beginning with "/tomcat-examples/" and ending in ".jsp" or
anything beginning with "/tomcat-examples/servlet" will get redirected to
Tomcat.

Okay.... fine. However, I can define other servlet mappings in the web.xml
file that don't get reflected in tomcat-auto. For example, suppose I made a
servlet called MyNewServlet.class and put it into tomcat-examples. Let's
also suppose that I mapped that to the path "newserv" in my web.xml.

If I do this, I can get to the servlet through Tomcat's HTTP port in one of
two ways:
  /tomcat-examples/servlet/MyNewServlet
or
  /tomcat-example/newserv

However, going through *Apache*, I can only use the first one, because
tomcat-auto tells Apache to only forward requests to Tomcat if it sees
something ending in *.jsp or something with "servlet" in the path.

So, my question is: shouldn't tomcat-auto also contain JkMount commands for
all servlets that I've mapped to paths in web.xml?

- Joe



Re: ClassNotFound exceptions with Tomcat/4.0-b2

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 2 Apr 2001, S Ramakrishnan wrote:

> Environment:
>    Windows2000
>    Tomcat4.0-b2 standalone
> 
> Problem:
> I recently upgraded to Tomcat/4.0-b2 from the previous version of
> 4.0. I find that its not able to locate the servlet class files
> under webapps/<mywebapp>/web-inf/classes.
> I do not have a security manager installed.
> 

If the actual directory name is "web-inf", then that is your problem.  All
pathnames in Tomcat 4.0 are case sensitive, so this must really be
webapps/<mywebapp>/WEB-INF/classes instead.

> This used to work before I upgraded. Is there a quirk with
> TC4.0-b2 about loading classes that I should be aware of?
> Also, what should be approach to troubleshoot this failure
> to load this class? I have set debug to 4 and am tracking
> logs\localhost_log*txt.
> 
> 
> 2001-04-02 14:13:21 StandardContext[/rks]: Mapping contextPath='/rks' with
> reque
> stURI='/rks/servlet/Quote' and relativeURI='/servlet/Quote'
> 2001-04-02 14:13:21 StandardContext[/rks]: Decoded
> relativeURI='/servlet/Quote'
> 2001-04-02 14:13:21 StandardContext[/rks]:   Trying exact match
> 2001-04-02 14:13:21 StandardContext[/rks]:   Trying prefix match
> 2001-04-02 14:13:21 StandardContext[/rks]:  Mapped to servlet 'invoker' with
> ser
> vlet path '/servlet' and path info '/Quote' and update=true
> 2001-04-02 14:13:21 StandardWrapper[/rks:org.apache.catalina.INVOKER.Quote]:
> Mar
> king servlet org.apache.catalina.INVOKER.Quote as unavailable
> 2001-04-02 14:13:21 invoker: serveRequest.load
> javax.servlet.ServletException: Wrapper cannot find servlet class Quote or a
> cla
> ss it depends on
>      [...]
> 
> The context is defined as follows:
> 
>   <servlet>
>     <servlet-name>
>         Quote
>     </servlet-name>
> 
>     <servlet-class>
>         Quote
>     </servlet-class>
>   </servlet>
> 

Is "Quote.class" in the WEB-INF/classes directory?  Along with any other
classes that it depends on?

> 
> Any hints appreciated,
> 
> Thanks,
> 
> Rk
> 
> 

Craig



ClassNotFound exceptions with Tomcat/4.0-b2

Posted by S Ramakrishnan <rk...@cisco.com>.
Environment:
   Windows2000
   Tomcat4.0-b2 standalone

Problem:
I recently upgraded to Tomcat/4.0-b2 from the previous version of
4.0. I find that its not able to locate the servlet class files
under webapps/<mywebapp>/web-inf/classes.
I do not have a security manager installed.

This used to work before I upgraded. Is there a quirk with
TC4.0-b2 about loading classes that I should be aware of?
Also, what should be approach to troubleshoot this failure
to load this class? I have set debug to 4 and am tracking
logs\localhost_log*txt.


2001-04-02 14:13:21 StandardContext[/rks]: Mapping contextPath='/rks' with
reque
stURI='/rks/servlet/Quote' and relativeURI='/servlet/Quote'
2001-04-02 14:13:21 StandardContext[/rks]: Decoded
relativeURI='/servlet/Quote'
2001-04-02 14:13:21 StandardContext[/rks]:   Trying exact match
2001-04-02 14:13:21 StandardContext[/rks]:   Trying prefix match
2001-04-02 14:13:21 StandardContext[/rks]:  Mapped to servlet 'invoker' with
ser
vlet path '/servlet' and path info '/Quote' and update=true
2001-04-02 14:13:21 StandardWrapper[/rks:org.apache.catalina.INVOKER.Quote]:
Mar
king servlet org.apache.catalina.INVOKER.Quote as unavailable
2001-04-02 14:13:21 invoker: serveRequest.load
javax.servlet.ServletException: Wrapper cannot find servlet class Quote or a
cla
ss it depends on
     [...]

The context is defined as follows:

  <servlet>
    <servlet-name>
        Quote
    </servlet-name>

    <servlet-class>
        Quote
    </servlet-class>
  </servlet>


Any hints appreciated,

Thanks,

Rk