1

In /conf/web.xml I've mentioned an tag as follows:

 <error-page>
    <exception-type>401</exception-type>
    <location>/error.jsp</location>
</error-page>
<error-page>
    <exception-type>403</exception-type>
    <location>/error.jsp</location>
</error-page>
<error-page>
    <exception-type>404</exception-type>
    <location>/error.jsp</location>
</error-page>
<error-page>
    <error-code>500</error-code>
    <location>/error.jsp</location>
</error-page>
<error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/error.jsp</location>
</error-page>

before this I also mentioned just

<error-page>
    <exception-type>404</exception-type>
    <location>/error.jsp</location>
</error-page>

but it's still rendering the same default page of tomcat instead of the custom "error.jsp" page. I'm stuck in the problem since last 13 hours.

1
  • Did you stop and restart Tomcat? Commented Jan 17, 2018 at 5:10

1 Answer 1

2

Try using error-code instead of exception-type

<error-page>
    <error-code>403</error-code>
    <location>/error.jsp</location>
</error-page>
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the reply. Actually I've kept the page "error.jsp" inside the /conf directly and it is not getting rendered. Can you please tell me where should I keep my error.jsp so that it gets rendered when 404(page is not found)
is the url updating?
Now its working fine. Actually we have to place the error.jsp inside the ROOT directory of tomcat. Thanks for ur responses. I made a silly mistake of using <exception-type> in place of <error-code>. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.