全部 -
有没有办法在ColdFusion中处理500 JRun servlet错误?我尝试使用cferror
以及在ColdFusion管理中使用网站范围的处理程序,但它似乎没有用。
以下是错误消息
500
ROOT CAUSE: java.lang.IllegalArgumentException at
coldfusion.filter.FormScope.parseName(FormScope.java:408) at
coldfusion.filter.FormScope.parseQueryString(FormScope.java:360) at
coldfusion.filter.FormScope.parsePostData(FormScope.java:328) at
coldfusion.filter.FormScope.fillForm(FormScope.java:278) at
coldfusion.filter.FusionContext.SymTab_initForRequest(FusionContext.java:438) at
coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:33) at
coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at
coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126) at
coldfusion.CfmServlet.service(CfmServlet.java:200) at
coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at
jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at
coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at
coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at
jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at
jrun.servlet.FilterChain.service(FilterChain.java:101) at
jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at
jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) at
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) at
jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) at
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at
jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
javax.servlet.ServletException: ROOT CAUSE:
java.lang.IllegalArgumentException at
coldfusion.filter.FormScope.parseName(FormScope.java:408) at
coldfusion.filter.FormScope.parseQueryString(FormScope.java:360) at
coldfusion.filter.FormScope.parsePostData(FormScope.java:328) at
coldfusion.filter.FormScope.fillForm(FormScope.java:278) at
coldfusion.filter.FusionContext.SymTab_initForRequest(FusionContext.java:438) at
coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:33) at
coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at
coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126) at
coldfusion.CfmServlet.service(CfmServlet.java:200) at
coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at
jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at
coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at
coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at
jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at
jrun.servlet.FilterChain.service(FilterChain.java:101) at
jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at
jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) at
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) at
jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) at
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at
jrunx.scheduler.WorkerThread.run(WorkerThread.java:66) at
coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:70) at
coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at
jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at
jrun.servlet.FilterChain.service(FilterChain.java:101) at
jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at
jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) at
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) at
jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) at
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at
jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
答案 0 :(得分:3)
您收到的错误发生在JRun级别。在ColdFusion错误处理程序可以捕获它之前发生此类错误。您需要在JRun级别创建并分配错误处理程序。这可以通过编辑web.xml文件来完成。 (进行更改后,您需要重新启动JRun服务器。)
详情可在此页JRun 4 Programmers Guide - Servlet Programming Techniques - Handling exceptions找到。
您可以使用WEB-INF / web.xml文件中的
error-page
元素定义Web应用程序如何处理错误。您还可以通过将error-page
元素添加到SERVER-INF / default-web.xml文件来定义JRun服务器上所有Web应用程序的错误处理。处理HTTP错误代码
web.xml文件中
error-code
的{{1}}子元素定义了JRun如何处理在处理servlet期间生成的HTTP错误代码。您为
error-page
元素定义HTTP状态代码,然后将代码映射到error-code
元素中的目标。以下示例将HTTP 500(内部服务器错误)状态代码映射到servererror.jsp页面:location
下表列出了常见的与错误相关的HTTP状态代码:
<error-page> <error-code>500</error-code> <location>/error-pages/servererror.jsp</location> </error-page>
访问错误属性
HTTP error code Description 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 408 Request Time-out 500 Internal Server Error
和HttpServletRequest
对象提供对错误信息的访问,以便您可以生成有意义的调试信息或目标异常处理程序。有关更多信息和示例,请参阅上面包含的链接。当抛出错误时,JRun在请求对象上设置了几个属性。以下描述了这些属性:
HttpServletResponse
- 将HTTP错误代码(如果适用)定义为int对象。如果servlet抛出与HTTP无关的异常,则状态代码通常设置为500(内部服务器错误)。javax.servlet.error.status_code
- 返回异常或错误消息。javax.servlet.error.message
- 定义例外类型。javax.servlet.error.exception_type
- 定义抛出的实际异常。您可以使用printStackTrace方法查看异常的堆栈跟踪。javax.servlet.error.exception
- 在抛出异常之前定义请求URI。