Empty page instead of custom tomcat error page

Alexander picture Alexander · Oct 4, 2010 · Viewed 14k times · Source

My setting: Apache 2.2 + Tomcat 6.0 @ Windows 2008 R2 64bit

  • static webpages: /
  • servlet: /foo
  • tomcat and apache are connected by mod_jk
  • 404.jsp is placed in tomcat\webapps\ROOT

tomcat\conf\web.xml:

<error-page>
 <error-code>404</error-code>
 <location>/404.jsp</location>
</error-page>

apache\conf\extra\httpd-ssl.conf:

JkMount /foo/* worker1
JkMount /404.jsp worker1

When I open https://...../404.jsp my custom error page is displayed. But when I open https://...../foo/nonexisting.html an empty page is displayed.

If I remove the <error-page>...</error-page> code from web.xml and open https://...../foo/nonexisting.html then tomcats own 404 is displayed.

Any hints?

Answer

Leon picture Leon · Nov 28, 2012

The Jkmount should have the context as parameter, ex:

JkMount /mycontext/* worker1

then the pages are accessed this way:

https://mycontext/someservlet/

or

https://mycontext/foo/nonexisting.html