Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-12776

Error exceptions when exporting a page that contains a simple macro to Word

XMLWordPrintable

      When exporting a page that contains a simple macro to Word, the following error exceptions shown:

      2008-08-14 16:21:01,359 ERROR [http-8029-Processor6] [confluence.util.velocity.VelocityUtils] getRenderedTemplate Error occurred rendering template: /foo/bar/foo.vm
      
       -- url: /exportword | userName: admin
      org.apache.velocity.exception.MethodInvocationException: Invocation of method 'requireResource' in  class $Proxy40 threw exception java.lang.NullPointerException @ /foo/bar/foo.vm[1,21]
      
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:286)
      
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
      
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:294)
      
      	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.SimpleNode.render(SimpleNode.java:318)
      
      	at org.apache.velocity.Template.merge(Template.java:254)
      
      	at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplateWithoutSwallowingErrors(VelocityUtils.java:56)
      
      	at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplate(VelocityUtils.java:34)
      
      	at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplate(VelocityUtils.java:27)
      
      	at foo.bar.ExampleMacro.execute(ExampleMacro.java:66)
      
      	at com.atlassian.renderer.v2.macro.ResourceAwareMacroDecorator.execute(ResourceAwareMacroDecorator.java:45)
      
      	at com.atlassian.renderer.v2.components.MacroRendererComponent.executeMacro(MacroRendererComponent.java:297)
      
      	at com.atlassian.renderer.v2.components.MacroRendererComponent.processMacro(MacroRendererComponent.java:255)
      
      	at com.atlassian.renderer.v2.components.MacroRendererComponent.makeMacro(MacroRendererComponent.java:151)
      
      	at com.atlassian.renderer.v2.components.WikiContentRendererHandler.handleMacro(WikiContentRendererHandler.java:18)
      
      	at com.atlassian.renderer.v2.WikiMarkupParser.makeMacro(WikiMarkupParser.java:126)
      
      	at com.atlassian.renderer.v2.WikiMarkupParser.makeMacro(WikiMarkupParser.java:114)
      
      	at com.atlassian.renderer.v2.WikiMarkupParser.handlePotentialMacro(WikiMarkupParser.java:99)
      
      	at com.atlassian.renderer.v2.WikiMarkupParser.parse(WikiMarkupParser.java:60)
      
      	at com.atlassian.renderer.v2.components.MacroRendererComponent.render(MacroRendererComponent.java:47)
      
      	at com.atlassian.renderer.v2.V2Renderer.render(V2Renderer.java:53)
      
      	at com.atlassian.renderer.v2.plugin.PluggableV2Renderer.render(PluggableV2Renderer.java:30)
      
      	at com.atlassian.renderer.v2.V2RendererFacade.convertWikiToXHtml(V2RendererFacade.java:57)
      
      	at sun.reflect.GeneratedMethodAccessor274.invoke(Unknown Source)
      
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
      	at java.lang.reflect.Method.invoke(Method.java:585)
      
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
      
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      
      	at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:20)
      
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      
      	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      
      	at $Proxy47.convertWikiToXHtml(Unknown Source)
      
      	at com.atlassian.confluence.servlet.ExportWordPageServer.service(ExportWordPageServer.java:138)
      
      	at com.atlassian.confluence.servlet.SpringManagedServlet.service(SpringManagedServlet.java:64)
      
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      
      	at com.atlassian.confluence.util.LoggingContextFilter.doFilter(LoggingContextFilter.java:49)
      
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      
      	at com.atlassian.confluence.util.UserThreadLocalFilter.doFilter(UserThreadLocalFilter.java:44)
      
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      
      	at com.atlassian.seraph.filter.SecurityFilter.doFilter(SecurityFilter.java:192)
      
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      
      	at com.atlassian.seraph.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:120)
      
      	at com.atlassian.confluence.util.AbstractBootstrapHotSwappingFilter.doFilter(AbstractBootstrapHotSwappingFilter.java:28)
      
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      
      	at com.atlassian.seraph.filter.BaseLoginFilter.doFilter(BaseLoginFilter.java:125)
      
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      
      	at com.atlassian.confluence.util.ClusterHeaderFilter.doFilter(ClusterHeaderFilter.java:35)
      
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      
      	at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:170)
      
      	at com.atlassian.spring.filter.FlushingSpringSessionInViewFilter.doFilterInternal(FlushingSpringSessionInViewFilter.java:29)
      
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
      
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      
      	at com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:94)
      
      	at com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:64)
      
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
      
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
      
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
      
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
      
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
      
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
      
      	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
      
      	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
      
      	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
      
      	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
      
      	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
      
      	at java.lang.Thread.run(Thread.java:595)
      
      Caused by: java.lang.NullPointerException
      
      	at com.atlassian.plugin.webresource.WebResourceManagerImpl.getIncludeMode(WebResourceManagerImpl.java:239)
      
      	at com.atlassian.plugin.webresource.WebResourceManagerImpl.requireResource(WebResourceManagerImpl.java:53)
      
      	at com.atlassian.confluence.plugin.webresource.DefaultConfluenceWebResourceManager.requireResource(DefaultConfluenceWebResourceManager.java:47)
      
      	at sun.reflect.GeneratedMethodAccessor110.invoke(Unknown Source)
      
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
      	at java.lang.reflect.Method.invoke(Method.java:585)
      
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
      
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      
      	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      
      	at $Proxy40.requireResource(Unknown Source)
      
      	at sun.reflect.GeneratedMethodAccessor109.invoke(Unknown Source)
      
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      
      	at java.lang.reflect.Method.invoke(Method.java:585)
      
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:295)
      
      	at com.atlassian.confluence.velocity.introspection.UnboxingMethod.invoke(UnboxingMethod.java:29)
      
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
      
      	... 83 more
      
      

      The problem can be reproduced with a macro which does nothing other than rendering a Velocity template which looks like this:

      foo.vm
      #requireResource("confluence.web.resources:prototype")
      Resource required!
      

      This problem also exists to the Dynamic Task List macro. I've attached the sample plugin to this issue, both binary and source, just in case you'd like to try it out.

        1. foo-bar.zip
          6 kB
        2. foo-bar-1.0-SNAPSHOT.jar
          3 kB

              Unassigned Unassigned
              mgchong Ming Giet Chong [Atlassian]
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: