我们的Tomcat服务器正在生成500个错误,并吐出以下堆栈跟踪信息,但是Google搜索根本原因(即utils.ManageIP.validIp)不会产生任何结果。

为什么utils.ManageIP.validIp为空?

这是导致可爱异常的代码:

String IP = request.getRemoteAddr();
if (!utils.ManageIP.validIp(IP)) {
   // Do stuff
}


困惑。有任何想法吗?

org.apache.jasper.JasperException: java.lang.NullPointerException
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694)
    org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665)
    org.apache.jsp.admin_jsp._jspService(admin_jsp.java:87)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause

java.lang.NullPointerException
    utils.ManageIP.validIp(ManageIP.java:113)
    org.apache.jsp.jsp.mainMenu_jsp._jspService(mainMenu_jsp.java:88)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694)
    org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665)
    org.apache.jsp.admin_jsp._jspService(admin_jsp.java:87)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.

最佳答案

utils.ManageIP?它是什么?你自己的图书馆?

编辑:评论证明,这是一个遗留的开发代码。

10-08 19:56