如何更改内部服务器错误的处理?
我的应用程序产生内部服务器错误,在 tomcat 上运行时它会打印带有给定错误的堆栈跟踪。在 Oracle 上,它会隐藏错误并将其发布到 application.log
中。
是否可以通过部署描述符更改此设置?
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 application log for details.
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 application log for details.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 web.xml 中定义错误处理页面:
如果应用程序显式设置了错误代码,请确保它使用 response.sendError() 而不是 response.setStatus() 因为后者会忽略 web 中定义的自定义错误页面.xml
p.s 通过谷歌搜索您的错误消息,我假设这是一个在 OAS
You can define error handling pages in your web.xml:
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