我在带有 JBoss 4.0.5.GA 的 Java EE 应用程序中出现了看似随机的 NullPointerExceptions。部署后,加载某些页面会导致 500 错误:
org.apache.jasper.JasperException: Unable to compile class for JSP
根本原因是:
java.lang.NullPointerException
java.util.Hashtable.put(Hashtable.java:396)
org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:3737)
org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2130)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1599)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1705)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1705)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1705)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1705)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3320)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
sun.reflect.GeneratedMethodAccessor385.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:592)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
java.security.AccessController.doPrivileged(Native Method)
atg.servlet.pipeline.TailPipelineServlet.service(TailPipelineServlet.java:90)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.servlet.pipeline.DispatcherPipelineServletImpl.service(DispatcherPipelineServletImpl.java:202)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.servlet.http.CookieBufferServlet.service(CookieBufferServlet.java:97)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.userprofiling.ExpiredPasswordServlet.service(ExpiredPasswordServlet.java:356)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.servlet.pipeline.MimeTyperPipelineServlet.service(MimeTyperPipelineServlet.java:206)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.droplet.DropletEventServlet.service(DropletEventServlet.java:565)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.servlet.sessionsaver.SessionSaverServlet.service(SessionSaverServlet.java:2442)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.commerce.order.CommerceCommandServlet.service(CommerceCommandServlet.java:128)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.commerce.promotion.PromotionServlet.service(PromotionServlet.java:191)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.userprofiling.AccessControlServlet.service(AccessControlServlet.java:602)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.userprofiling.PageEventTriggerPipelineServlet.service(PageEventTriggerPipelineServlet.java:169)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.userprofiling.SessionEventTrigger.service(SessionEventTrigger.java:461)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.userprofiling.ProfileRequestServlet.service(ProfileRequestServlet.java:477)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.servlet.pipeline.DynamoPipelineServlet.service(DynamoPipelineServlet.java:469)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.servlet.pipeline.PathAuthenticationPipelineServlet.service(PathAuthenticationPipelineServlet.java:370)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.userprofiling.sso.PassportServlet.service(PassportServlet.java:561)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.servlet.security.ThreadUserBinderServlet.service(ThreadUserBinderServlet.java:91)
atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:116)
atg.servlet.pipeline.HeadPipelineServlet.passRequest(HeadPipelineServlet.java:1099)
atg.servlet.pipeline.HeadPipelineServlet.service(HeadPipelineServlet.java:781)
atg.servlet.pipeline.PipelineableServletImpl.service(PipelineableServletImpl.java:231)
atg.filter.dspjsp.PageFilter.doFilter(Unknown Source)
sun.reflect.GeneratedMethodAccessor412.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:592)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)
java.security.AccessController.doPrivileged(Native Method)
com.quebecor.commerce.filter.OpenSessionFilter.doFilter(OpenSessionFilter.java:49)
sun.reflect.GeneratedMethodAccessor411.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:592)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)
java.security.AccessController.doPrivileged(Native Method)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
sun.reflect.GeneratedMethodAccessor410.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:592)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)
- 这不会在可重复的基础上发生。在夜间,错误有时会消失。
- 有时,只需重新启动服务器(无需重新部署)就会导致错误消失。
- 在部署之间,发生错误的页面可能会发生变化。
- 这不会发生在开发机器上,但会发生在每晚构建和预生产环境中。因为在dev中不会出现,所以无法直接调试...
- 在我们的 nightly 和 pre-prod 部署中,work 和 tmp 文件夹在每次部署时都被完全清空。
我们正在使用 JBoss 4.0.5.GA 和 Java 1.5.0_11。我们还使用 Tiles 2.0.6 和 ATG 电子商务框架 2007.1。我们没有升级、替换或删除我们的任何项目依赖项。
有趣的是,这只发生在我们网站的一个新部分中,我们基于新的独立 Tiles 模板从头开始开发了一组新的 JSP。该网站的现有部分不显示任何这些错误。
我尝试使用 JSPC 预编译 JSP 页面(使用此处的说明:http: //tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html#Web%20Application%20Compilation)。所有页面都编译成功。
我有点不知所措。以前有人见过这个错误吗?任何提示或想法将不胜感激!