生产中的JSP errorPage异常95%的情况为null,可能是什么原因?

时间:2013-10-30 07:23:01

标签: java jsp exception-handling error-handling glassfish

错误页面配置为:

<error-page>
    <error-code>404</error-code>
    <location>/common/general-error.jsp</location>
</error-page>
<error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/common/general-error.jsp</location>
</error-page>

General-error.jsp:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page isErrorPage="true" %>
  <%
  String referer = request.getHeader("Referer");
  if (referer != null && !"null".equals(referer) && !referer.contains("googleads.g.doubleclick.net/pagead")) {
    Logger.getLogger(this.getClass().getName()).severe("GENERAL ERROR MESSAGE: requestUrl= " + request.getRequestURI() + "?" + request.getQueryString() 
          +  ",      referer:" + referer);
  }
if (exception != null) {
  Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "ERROR CAUSE:" +    exception.getMessage(), exception);
  }

很明显,在我们的Web应用程序中,每秒大约有20个请求,大多数日志都不包含exception。所以exception几乎总是空的!我觉得很奇怪。

知道这可能是什么原因?如果这是重要的话,我们正在使用glassfish。

BTW,正确打印引荐来源,来自日志的快照:

[#|2013-10-31T02:32:55.903+0100|SEVERE|glassfish3.1.2|org.apache.jsp.common.general_002derror_jsp|_ThreadID=67;_ThreadName=Thread-2;|GENERAL ERROR MESSAGE: requestUrl= /LivingCost/common/general-error.jsp?null, referer:http://www.priceline.com/delta-grand-okanagen-resort-and-conference-centre-kelowna-british-columbia-BC-144934-hd.hotel-reviews-hotel-guides|#]

[#|2013-10-31T02:37:23.471+0100|SEVERE|glassfish3.1.2|org.apache.jsp.common.general_002derror_jsp|_ThreadID=21;_ThreadName=Thread-2;|GENERAL ERROR MESSAGE: requestUrl= /LivingCost/common/general-error.jsp?null, referer:http://www.numbeo.com/cost-of-living/country_result.jsp?country=Taiwan|#]

[#|2013-10-31T02:37:23.663+0100|SEVERE|glassfish3.1.2|org.apache.jsp.common.general_002derror_jsp|_ThreadID=37;_ThreadName=Thread-2;|GENERAL ERROR MESSAGE: requestUrl= /LivingCost/common/general-error.jsp?null, referer:http://www.numbeo.com/cost-of-living/country_result.jsp?country=Taiwan|#]

0 个答案:

没有答案