Hi
I’m trying to render the contents of a slot that doesn’t exist on the page. I have a homepage with a featured news slot and the same slot on the news and event page. I only want the users to update the homepage and the news and events page will automatically be updated.
I’ve written a macro to do this and all works fine apart from rendering the actual template.
#macro(get_slot_contents_by_ID $id $slotname $header $before $after $footer)
#set($guid = $user.psoObjectFinder.getGuidById($id,'1'))
#set($node = $user.psoObjectFinder.getNodeByGuid($guid))
#set($clone = $sys.assemblyItem.clone())
$clone.setNode($node)
#set($results = $user.psoSlotTools.getSlotContents($clone,$slotname,$params))
#if($tools.math.toInteger($results.size()) > 0)##
$header##
#foreach( $relresult in $results )##
$relresult
$footer##
#end
#end##
#end
The “$relresult” is the correct assembly item but when I use $rx.doc.extractBody to render the template I get the follow error in the console.log file:
2009-06-03 12:53:57,897 ERROR [PSVelocityAssembler] Problem assembling output for item: 1-101-94167 with template: intranetPgNewsEvents
java.lang.NullPointerException
at java.io.ByteArrayInputStream.<init>(Unknown Source)
at com.percussion.services.assembly.jexl.PSDocumentUtils.extractBody(Unknown Source)
at sun.reflect.GeneratedMethodAccessor931.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:267)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:197)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:70)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:172)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
at org.apache.velocity.Template.merge(Template.java:256)
at com.percussion.services.assembly.impl.plugin.PSVelocityAssembler.assembleSingle(Unknown Source)
at com.percussion.services.assembly.impl.plugin.PSAssemblerBase.doAssembleSingle(Unknown Source)
at com.percussion.services.assembly.impl.plugin.PSVelocityAssembler.doAssembleSingle(Unknown Source)
at com.percussion.services.assembly.impl.plugin.PSAssemblerBase$_b.super(Unknown Source)
at com.percussion.services.assembly.impl.plugin.PSAssemblerBase$_b.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.percussion.services.assembly.impl.plugin.PSAssemblerBase.assemble(Unknown Source)
at com.percussion.services.assembly.impl.PSAssemblyService.assemble(Unknown Source)
at sun.reflect.GeneratedMethodAccessor240.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
at $Proxy90.assemble(Unknown Source)
at com.percussion.services.assembly.impl.plugin.PSDispatchAssembler.assembleSingle(Unknown Source)
at com.percussion.services.assembly.impl.plugin.PSAssemblerBase.doAssembleSingle(Unknown Source)
at com.percussion.services.assembly.impl.plugin.PSAssemblerBase$_b.super(Unknown Source)
at com.percussion.services.assembly.impl.plugin.PSAssemblerBase$_b.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at com.percussion.services.assembly.impl.plugin.PSAssemblerBase.assemble(Unknown Source)
at com.percussion.services.assembly.impl.PSAssemblyService.assemble(Unknown Source)
at com.percussion.services.assembly.impl.PSAssemblyService.processServletRequest(Unknown Source)
at sun.reflect.GeneratedMethodAccessor312.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
at $Proxy90.processServletRequest(Unknown Source)
at com.percussion.services.assembly.impl.PSAssemblyServlet.service(Unknown Source)
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.percussion.webdav.PSWebDavRequestFilter.doFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.percussion.servlets.PSSecurityFilter.doFilter(Unknown Source)
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:81)
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.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
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.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Unknown Source)
Any clues?
Cheers
James