Velocity
  1. Velocity
  2. VELOCITY-610

Under load java.lang.NullPointerException

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Linux, Jboss 4.0.4

      Description

      We are getting the following error in our logs under load. I have seen Bug VELOCITY-383 and this seems to be a similar issue

      Caused by:
      java.lang.NullPointerException
      at org.apache.velocity.runtime.parser.node.ASTDirective.init(ASTDirective.java:134)
      at org.apache.velocity.runtime.parser.node.SimpleNode.init(SimpleNode.java:285)
      at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:169)
      at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
      at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:88)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      at org.apache.velocity.runtime.directive.Parse.render(Parse.java:224)
      at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      at org.apache.velocity.runtime.directive.Parse.render(Parse.java:224)
      at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:194)
      at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
      at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:88)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      at org.apache.velocity.Template.merge(Template.java:254)
      at org.springframework.web.servlet.view.velocity.VelocityView.mergeTemplate(VelocityView.java:555)
      at org.springframework.web.servlet.view.velocity.VelocityView.doRender(VelocityView.java:500)
      at org.springframework.web.servlet.view.velocity.VelocityView.renderMergedTemplateModel(VelocityView.java:320)
      at org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:178)
      at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:249)
      at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1063)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:827)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:736)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at com.elasticpath.commons.filter.impl.CachingControlFilter.doFilter(CachingControlFilter.java:163)
      at com.elasticpath.sfweb.filters.EpFilterToBeanProxy.doFilter(EpFilterToBeanProxy.java:137)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at com.elasticpath.sfweb.filters.CustomerSessionFilter.doFilter(CustomerSessionFilter.java:68)
      at com.elasticpath.sfweb.filters.EpFilterToBeanProxy.doFilter(EpFilterToBeanProxy.java:137)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:292)
      at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
      at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:79)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
      at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:143)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
      at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:246)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
      at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:220)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
      at org.acegisecurity.securechannel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:168)
      at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)
      at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:173)
      at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at com.elasticpath.commons.filter.impl.EncodingFilter.doFilter(EncodingFilter.java:72)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
      at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
      at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
      at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
      at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Thread.java:595)

        Activity

        Hide
        Nathan Bubna added a comment -

        Hi Wayne,

        This appears to be happening in a Velocimacro inside a Velocimacro and occurs during Template merge, rather than during Template process (as is the case with VELOCITY-383). The underlying implementation of Velocimacro support has changed dramatically since 1.5 was released and many, many things have been improved including much load testing. Do you think you could try a build of the current SVN trunk (1.6-dev) and see if this problem occurs in that? If it's too much trouble to build a jar of the current trunk to use, let me know and i can provide one for you. if you want to do some Velocimacro load testing yourself, see VELOCITY-607 for discussion and access to a load testing suite that Jarkko cooked up. Perhaps then you can even produce a testcase for us to try?

        thanks,
        nathan

        Show
        Nathan Bubna added a comment - Hi Wayne, This appears to be happening in a Velocimacro inside a Velocimacro and occurs during Template merge, rather than during Template process (as is the case with VELOCITY-383 ). The underlying implementation of Velocimacro support has changed dramatically since 1.5 was released and many, many things have been improved including much load testing. Do you think you could try a build of the current SVN trunk (1.6-dev) and see if this problem occurs in that? If it's too much trouble to build a jar of the current trunk to use, let me know and i can provide one for you. if you want to do some Velocimacro load testing yourself, see VELOCITY-607 for discussion and access to a load testing suite that Jarkko cooked up. Perhaps then you can even produce a testcase for us to try? thanks, nathan
        Hide
        Wayne Baskin added a comment -

        Hi Nathan,

        We have a load testing suite setup. Can you please send me a copy of 1.6-dev and I will throw that into our test environment

        Thanks

        Wayne

        Show
        Wayne Baskin added a comment - Hi Nathan, We have a load testing suite setup. Can you please send me a copy of 1.6-dev and I will throw that into our test environment Thanks Wayne
        Hide
        Nathan Bubna added a comment -

        Any news on how 1.6-dev worked for you, Wayne? In case you missed it, i put a build up at:

        http://people.apache.org/~nbubna/velocity/engine/1.6-dev/

        Show
        Nathan Bubna added a comment - Any news on how 1.6-dev worked for you, Wayne? In case you missed it, i put a build up at: http://people.apache.org/~nbubna/velocity/engine/1.6-dev/
        Hide
        Wayne Baskin added a comment -

        Thanks Nathan,

        Yeh must have missed it. Now I have it I'll perform some load testing and let you know.

        Thanks again

        Wayne

        Show
        Wayne Baskin added a comment - Thanks Nathan, Yeh must have missed it. Now I have it I'll perform some load testing and let you know. Thanks again Wayne
        Hide
        Wayne Baskin added a comment -

        Hi Nathan,

        I am now getting the following error when mI try start my application.

        Error creating bean with name 'velocityEngine' defined in ServletContext resource [/WEB-INF/conf/spring/commons/util-config.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/lang/text/StrBuilder
        Caused by:
        java.lang.NoClassDefFoundError: org/apache/commons/lang/text/StrBuilder

        Show
        Wayne Baskin added a comment - Hi Nathan, I am now getting the following error when mI try start my application. Error creating bean with name 'velocityEngine' defined in ServletContext resource [/WEB-INF/conf/spring/commons/util-config.xml] : Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/lang/text/StrBuilder Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/text/StrBuilder
        Hide
        Claude Brisson added a comment -

        It's probably because you were using the velocity-dep jar file (which is velocity plus all dependancies in a single jar file) - try adding all the velocity dependancies to your classpath ( http://velocity.apache.org/engine/releases/velocity-1.5/jar-dependencies.html ) - plus, it's good practice to load the dependancies separately.

        Show
        Claude Brisson added a comment - It's probably because you were using the velocity-dep jar file (which is velocity plus all dependancies in a single jar file) - try adding all the velocity dependancies to your classpath ( http://velocity.apache.org/engine/releases/velocity-1.5/jar-dependencies.html ) - plus, it's good practice to load the dependancies separately.
        Hide
        Nathan Bubna added a comment -

        Sorry, i might have warned you. For 1.6, our commons-lang dependency has been upgraded to version 2.4. Either use the velocity-dep jar, which includes all the dependencies, but is, as Claude says, not the ideal practice, or else add all the dependencies independently, being sure to upgrade commons-lang to 2.4.

        Show
        Nathan Bubna added a comment - Sorry, i might have warned you. For 1.6, our commons-lang dependency has been upgraded to version 2.4. Either use the velocity-dep jar, which includes all the dependencies, but is, as Claude says, not the ideal practice, or else add all the dependencies independently, being sure to upgrade commons-lang to 2.4.
        Hide
        Wayne Baskin added a comment -

        Thanks guys got it started.

        Just upgraded commons-lang.

        Show
        Wayne Baskin added a comment - Thanks guys got it started. Just upgraded commons-lang.
        Hide
        Wayne Baskin added a comment -

        Hi guys,

        So far mid-way through stress testing things are looking good.
        When is 1.6 scheduled for release?

        Thanks

        Wayne

        Show
        Wayne Baskin added a comment - Hi guys, So far mid-way through stress testing things are looking good. When is 1.6 scheduled for release? Thanks Wayne
        Hide
        Nathan Bubna added a comment -

        Ok, i'll go ahead and mark this resolved. Please re-open if further testing shows this happening again.

        As for release schedule, there is none. Release happen when people make them happen. I may try to push out a beta release soon, but i can't promise anything. For a final release, we will probably want to resolve a few more of the JIRA issues scheduled for 1.6. If you want to speed things up, you can help with those.

        Show
        Nathan Bubna added a comment - Ok, i'll go ahead and mark this resolved. Please re-open if further testing shows this happening again. As for release schedule, there is none. Release happen when people make them happen. I may try to push out a beta release soon, but i can't promise anything. For a final release, we will probably want to resolve a few more of the JIRA issues scheduled for 1.6. If you want to speed things up, you can help with those.

          People

          • Assignee:
            Unassigned
            Reporter:
            Wayne Baskin
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development