2

我的应用程序产生了一个内部服务器错误,在 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.
4

1 回答 1

3

您可以在 web.xml 中定义错误处理页面:

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

如果您的应用程序明确设置了错误代码,请确保它使用response.sendError()而不是response.setStatus(),因为后者将忽略您在 web.xml 中定义的自定义错误页面

ps 通过谷歌搜索您的错误消息,我假设这是在OAS上运行的 Java Web 应用程序

于 2010-02-19T07:54:26.680 回答