Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

web.xml and multiple error-page tags

843842May 4 2008 — edited Feb 13 2009
Hi,

I recently had some mappings changed on my server and I can now access servlets with / instead of /servlet. This means that all requests are now mapped to tomcat instead of apache. Now my questions are:

1. Will it in anyway deteriorate the performance of the website now that the main server is tomcat?

2. I tried to include custom error messages with the following web.xml...
<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <servlet>
        <servlet-name>contactServlet</servlet-name>
        <servlet-class>contactServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>contactServlet</servlet-name>
        <url-pattern>/contactServlet</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <error-page> 
        <error-code>400</error-code> 
        <location>../../error_docs/bad_request.html</location> 
    </error-page>
    <error-page> 
        <error-code>401</error-code> 
        <location>../../error_docs/unauthorized.html</location> 
    </error-page>    
    <error-page> 
        <error-code>403</error-code> 
        <location>../../error_docs/forbidden.html</location> 
    </error-page>    
    <error-page> 
        <error-code>404</error-code> 
        <location>../../error_docs/not_found.html</location> 
    </error-page>    
    <error-page> 
        <error-code>405</error-code> 
        <location>../../error_docs/method_not_allowed.html</location> 
    </error-page>    
    <error-page> 
        <error-code>406</error-code> 
        <location>../../error_docs/not_acceptable.html</location> 
    </error-page>        
    <error-page> 
        <error-code>407</error-code> 
        <location>../../error_docs/proxy_authentication_required.html</location> 
    </error-page>
    <error-page> 
        <error-code>412</error-code> 
        <location>../../error_docs/precondition_failed.html</location> 
    </error-page>     
    <error-page> 
        <error-code>414</error-code> 
        <location>../../error_docs/request-uri_too_long.html</location> 
    </error-page>     
    <error-page> 
        <error-code>415</error-code> 
        <location>../../error_docs/unsupported_media_type.html</location> 
    </error-page>     
    <error-page> 
        <error-code>500</error-code> 
        <location>../../error_docs/internal_server_error.html</location> 
    </error-page> 
    <error-page> 
        <error-code>501</error-code> 
        <location>../../error_docs/not_implemented.html</location> 
    </error-page> 
    <error-page> 
        <error-code>502</error-code> 
        <location>../../error_docs/bad_gateway.html</location> 
    </error-page>     
    <welcome-file-list>
	<welcome-file>
            index.html
        </welcome-file>
    </welcome-file-list>
</web-app>
but accessing anything including http://www.mydomain.com

returns
HTTP Status 404 - /

type Status report

message /

description The requested resource (/) is not available.
Apache Tomcat/5.5.20
Any suggestions ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 13 2009
Added on May 4 2008
4 comments
1,175 views