开发者

How to change handling of internal server error?

开发者 https://www.devze.com 2022-12-20 20:30 出处:网络
My application produces an internal server error, running on tomcat it prints a stacktrace with the given error. On Oracle it hides the error and post it to application.log.

My application produces an internal server error, running on tomcat it prints a stacktrace with the given error. On Oracle it hides the error and post it to application.log.

Is it possible to change this setting via the deployment descriptor?

500 Internal Server Error

Servlet error: An exception occurred. The current application deployment
descriptors do not allow for including it in this response. 

Please consult the app开发者_如何学运维lication log for details.


You can define error handling pages in your web.xml:

<error-page>
    <error-code>500</error-code>
    <location>/WEB-INF/pages/500.jsp</location>
</error-page>

If the error code is explicitly set by your application make sure it uses response.sendError() and not response.setStatus() because the latter will ignore your custom error pages defined in web.xml

p.s By googling your error message I assume that this is a Java web application running on OAS

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号