wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Customize 404 errors in Apache Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Customize 404 errors in Apache Tomcat" Watch "Customize 404 errors in Apache Tomcat" New topic
Author

Customize 404 errors in Apache Tomcat

John Bruso
Greenhorn

Joined: Dec 16, 2005
Posts: 1
One would think the answer to this question is all over the web. But honestly, I can't find any good answers.

I want to customize (or redirect) the 400-500 errors running on my apache tomcat server.

Oddly, the current 404 message is blank.. doesn't even say 404??

The source of the page is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>


I've edited the web.xml file here at the very bottom and restarted the server:
C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\web.xml

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

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

</web-app>

Do I need to move this file to somewhere else, like under the webapps directory?

Also, I placed the error404.jsp page isnide this directory:
C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\Catalina\localhost

So, I'm lost... thank you for your help.

John
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Each application running under Tomcat will have it's own web.xml file (located under the WEB-INF directory.

The location entry will list the location of the JSP relative to the root of the application.

Example (assuming your app is named "MyApp"):
tomcat/webapps/MyApp
tomcat/webapps/MyApp/error404.jsp
tomcat/webapps/MyApp/WEB-INF/web.xml

When Tomcat starts up, it scans the webapps directory for war files or properly constructed directory structures and deploys them as web applications.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Customize 404 errors in Apache Tomcat
 
Similar Threads
problems with web.xml
HTTP Status 404 - /myApp/servlet/Testing
applet not loading
attribute problem in custom tag
JSP error using tomcat