随机JSP补偿错误 - NullPointerException

时间:2012-10-01 20:10:48

标签: jsp jboss nullpointerexception tiles

我在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中出现,所以我无法直接调试它......
  • 在我们的夜间和预先部署的部署中,每次部署时都会清空工作和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)。所有页面都成功编译。

我有点失落。以前有人见过这个错误吗?任何提示或想法将不胜感激!

1 个答案:

答案 0 :(得分:0)

经过调查,似乎编译问题与来自图块库的某个标签上的Tag getters / setters类型不匹配有关。

升级到tiles 2.0.7后,问题似乎已解决。

jasper编译机制(至少在那个版本的tomcat中)使用java.beans.Introspector。 getXXX和setXXX之间的类型不匹配可能会破坏内省过程。

几年前,tile开发团队已经解决了这个问题,请在https://issues.apache.org/jira/browse/TILES-276了解更多信息