tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject RE: reference to external error-page
Date Fri, 03 Jan 2003 19:32:03 GMT
I really haven't spent much time integrating Apache and TC, but don't you need
an "ajp13" tacked to the end of JkMount? Assuming the JkMount stuff is okay,
what happens if you change the Host tag in TC's server.xml to:

<Host errorReportValveClass="" ... >

AFAICT, the default error reporter (org.apache.catalina.valves.ErrorReportValve)
is what's dumping the error page output. Perhaps removing the valve will allow
Apache to handle the error.

Quoting Michael Mendelson <mmendelson@intowndenver.com>:

> 
> > #ErrorDocument 404 /missing.html
> 
> Right, I've got something like this in httpd.conf.  But what I have found
> is
> that if page handling is directed to Tomcat (using JkMount), these
> directives
> are not honored.  In other words, if my mounting looks like:
> 
> ErrorDocument 404 /missing.html
> JkMount /myproject/*.jsp
> 
> If I'm looking for http://mydomain.com/bogus.jsp, then the 404 is handled
> through httpd.
> If I'm looking for http://mydomain.com/myproject/bogus.jsp, then the 404 is
> handled through Tomcat.
> 
> What I would like to do, in simple terms, is to redirect my tomcat errors to
> the
> same page.
> 
> 
> Maybe my httpd.conf is incorrectly configured?
> 
> 
> Michael Mendelson
> In Town Consulting, LLC
> www.intowndenver.com
> 
> > -----Original Message-----
> > From: Kris Schneider [mailto:kris@dotech.com]
> > Sent: Friday, January 03, 2003 10:12 AM
> > To: Tomcat Users List; Michael Mendelson
> > Subject: RE: reference to external error-page
> >
> >
> > If you just want custom error pages for Apache, check out the
> > following snippet
> > from httpd.conf:
> >
> > # Customizable error responses come in three flavors:
> > # 1) plain text 2) local redirects 3) external redirects
> > #
> > # Some examples:
> > #ErrorDocument 500 "The server made a boo boo."
> > #ErrorDocument 404 /missing.html
> > #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
> > #ErrorDocument 402 http://www.example.com/subscription_info.html
> >
> > Quoting Michael Mendelson <mmendelson@intowndenver.com>:
> >
> > >
> > > Thanks Kris,
> > >
> > > This works fine if the error page is another Tomcat context, but I was
> > > wondering
> > > if there was an elegant way to set this up in the httpd.conf or
> server.xml,
> > > without the need for an error-handling jsp to do the rerouting.
> > >
> > > I will probably just go that route, since it won't be difficult to
> write,
> > > but
> > > further ideas are appreciated.
> > >
> > > Michael Mendelson
> > > In Town Consulting, LLC
> > > www.intowndenver.com
> > >
> > >
> > > > -----Original Message-----
> > > > From: Kris Schneider [mailto:kris@dotech.com]
> > > > Sent: Friday, January 03, 2003 7:18 AM
> > > > To: Tomcat Users List
> > > > Subject: Re: reference to external error-page
> > > >
> > > >
> > > > Well, you can't do it directly with an error page, the <location>
> > > > element's body
> > > > is required to contain an application-relative resource. Since
> > you're using
> > > TC
> > > > 4.x, you could take adavantage of JSTL to do something like:
> > > >
> > > > web.xml:
> > > > <error-page>
> > > >   <error-code>404</error-code>
> > > >   <location>/error/404.jsp</location>
> > > > </error-page>
> > > >
> > > > /error/404.jsp:
> > > > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
> > > > <c:import url="/error/404.html" context="/otherContext"/>
> > > >
> > > > This is equivalent to using the following in a servlet:
> > > >
> > > > ServletContext foreign =
> getServletContext().getContext("/otherContext");
> > > > RequestDispatcher rd =
> foreign.getRequestDispatcher("/error/404.html");
> > > > rd.include(request, response);
> > > >
> > > > So, the error page is still part of the app, it just imports a
> > > > foreign resource
> > > > to display the error message. Will that work for what you want to do?
> > > >
> > > > Quoting Michael Mendelson <mmendelson@intowndenver.com>:
> > > >
> > > > >
> > > > > Hello all,
> > > > >
> > > > > I would like to use an error page for certain apache/httpd errors
> as
> > > well
> > > > > as
> > > > > tomcat errors (e.g. 404). In the web.xml file though, the
> directive...
> > > > >
> > > > >
> > > >
> ----------------------------------------------------------------------
> > > > ----------
> > > > >    <error-page>
> > > > > 	<error-code>404</error-code>
> > > > > 	<location>/error/404.html</location>
> > > > >    </error-page>
> > > > >
> > > >
> ----------------------------------------------------------------------
> > > > ----------
> > > > >
> > > > > ...routes me to http://localhost/projectname/error/404.html.
> > > > >
> > > > > How would I route to an error page location that might be on the
> same
> > > > > server,
> > > > > but external to the project?
> > > > >
> > > > > I'm using Apache 1.3.23 and Tomcat 4.1.18 (and mod_jk to route
> requests
> > > to
> > > > > tomcat), if it matters.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Michael
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > > <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> > > > > For additional commands, e-mail:
> > > > > <mailto:tomcat-user-help@jakarta.apache.org>
> > > > >
> > > >
> > > >
> > > > --
> > > > Kris Schneider <mailto:kris@dotech.com>
> > > > D.O.Tech       <http://www.dotech.com/>
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> > > > For additional commands, e-mail:
> > > <mailto:tomcat-user-help@jakarta.apache.org>
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <mailto:tomcat-user-help@jakarta.apache.org>
> > >
> >
> >
> > --
> > Kris Schneider <mailto:kris@dotech.com>
> > D.O.Tech       <http://www.dotech.com/>
> >
> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:tomcat-user-help@jakarta.apache.org>
> 


-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message