You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Bauer, Margaret M (Peggy)" <ma...@verizon.com.INVALID> on 2019/12/03 13:18:47 UTC

Re: [E] Global Error Handling

I think you can add your customized jsp page within your web.xml by
modifying path and file name

 <error-page>
    <error-code>401</error-code>
    <location>/WEB-INF/jsp/401.jsp</location>
  </error-page>
  <error-page>
    <error-code>403</error-code>
    <location>/WEB-INF/jsp/403.jsp</location>
  </error-page>
  <error-page>
    <error-code>404</error-code>
    <location>/WEB-INF/jsp/404.jsp</location>
  </error-page>

On Tue, Dec 3, 2019 at 8:11 AM Sumit Bhardwaj <su...@gmail.com>
wrote:

> Hi Experts,
>
> We have a requirement from a customer, where in case of 404, where someone
> is putting an invalid url, instead of showing the default error, we should
> be showing a custom message.
>
> Is this possible?
>
> I have searched and found couple of solutions similar to
>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_questions_27859626_tomcat-2Dserver-2Dchange-2Ddefault-2Dhttp-2D404&d=DwIBaQ&c=udBTRvFvXC5Dhqg7UHpJlPps3mZ3LRxpb6__0PomBTQ&r=JYuCIQ8r7H-c_yYFTZ4gdv4goO0lCCtidMRmNza4zoA&m=W70UQy0yQZ6RcqlHmp6JmY1-JKse-vhMHnH9vleLY7o&s=rhOgsU2tAGMdFGQL-8RDhOtdkd11pYl5mOR1R4rQNKI&e=
>
>
> but these did not work, these work at the app level, but not globally on
> tomcat level.
>
> e.g. if i have an app called myapp
>
> http://<server address>/myapp/<invalid path> This  works and it gets
> redirected to custom page
>
> but
>
> http://<server address>/<invalid App>, This does not work and 404 is
> shown,
>
> Is there someway we can handle errors at global level on tomca.t
>
> We are using tomcat 9.0.24.
>
> Thanks for your help.
>
> Best
> Sumit Bhardwaj
>


-- 
*Peggy Bauer*
CAO Production Support
214-770-1782