Hi!
I've made a panel that displays tags in a tag cloud (size relative to
occurrence). But on a few occasions I get an exception, and I've managed
to pinpoint fairly accurately under what circumstance. The code
involved, that usually works is this:
#set($query = "select elements(prop.list) from BaseObject as obj,
DBStringListProperty as prop where obj.className='XWiki.TagClass' and
obj.id=prop.id.id and prop.id.name='tags'")
#set( $allTags = $xwiki.search($query))
#set( $allTagsSorted = $xwiki.sort($allTags))
If the user is not logged in, and presses the login link in the top left
corner (--> /xwiki/bin/login/XWiki/XWikiLogin), the panel returns the
enclosed exception. After some debugging, it seems that $allTags is not
assigned a value from $xwiki.search($query). This leads me to believe
that $xwiki might not be available from this particular context. Has
anyone else encountered this, or is it an artifact in my environment?
I'm running xwiki v1.1-milestone2, mysql, winxp, tomcat, java5. Both my
db and xwiki installs are pretty fresh and un-tampered with.
best regards :-)
Thomas
13:47:50,211 ERROR http-9080-2
http://myHost:9080/xwiki/bin/login/XWiki/XWikiLogin?xredirect=http%3A%2F%2F…
SimpleLog4JLogSystem:logVelocityMessage:154 - Method sort threw exception for reference
$xwiki in template XWiki.XWikiLogin at [6,24]
org.apache.velocity.exception.MethodInvocationException: Invocation of method
'sort' in class com.xpn.xwiki.api.XWiki threw exception
java.lang.NullPointerException @ XWiki.XWikiLogin[6,31]
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.value(ASTReference.java:419)
at
org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:73)
at
org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:125)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at
com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:240)
at
com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:143)
at
com.xpn.xwiki.render.XWikiVelocityRenderer.render(XWikiVelocityRenderer.java:91)
at
com.xpn.xwiki.render.DefaultXWikiRenderingEngine.renderText(DefaultXWikiRenderingEngine.java:229)
at
com.xpn.xwiki.render.DefaultXWikiRenderingEngine.renderText(DefaultXWikiRenderingEngine.java:161)
at
com.xpn.xwiki.render.DefaultXWikiRenderingEngine.renderText(DefaultXWikiRenderingEngine.java:132)
at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:366)
at
com.xpn.xwiki.objects.classes.TextAreaClass.displayView(TextAreaClass.java:165)
at com.xpn.xwiki.doc.XWikiDocument.display(XWikiDocument.java:1265)
at com.xpn.xwiki.doc.XWikiDocument.display(XWikiDocument.java:1245)
at com.xpn.xwiki.api.Document.display(Document.java:864)
at sun.reflect.GeneratedMethodAccessor90.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 org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
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.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
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.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.directive.Foreach.render(Foreach.java:448)
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
com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:240)
at
com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:143)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1249)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1218)
at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:491)
at sun.reflect.GeneratedMethodAccessor59.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 org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
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
com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:240)
at
com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:143)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1249)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1218)
at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:491)
at sun.reflect.GeneratedMethodAccessor59.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 org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
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.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at
com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:240)
at
com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:143)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1249)
at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1218)
at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:98)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:159)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:118)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
at java.util.Collections.sort(Collections.java:116)
at com.xpn.xwiki.api.XWiki.sort(XWiki.java:1676)
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.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:295)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
... 99 more