Permission setting results in the following (this example is for a particular space):
Error number 4001 in 4: Error while parsing velocity page Wrapped Exception: Invocation of method 'getSpaces' in class com.xpn.xwiki.api.XWiki threw exception com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception while searching documents with sql select distinct doc.web from XWikiDocument doc Wrapped Exception: could not execute query @ [62,34]

Error number 4001 in 4: Error while parsing velocity page
Wrapped Exception: Invocation of method 'getSpaces' in  class com.xpn.xwiki.api.XWiki threw exception com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception while searching documents with sql select distinct doc.web from XWikiDocument doc

Wrapped Exception: could not execute query @ <unknown template>[62,34]
com.xpn.xwiki.XWikiException: Error number 4001 in 4: Error while parsing velocity page
Wrapped Exception: Invocation of method 'getSpaces' in  class com.xpn.xwiki.api.XWiki threw exception com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception while searching documents with sql select distinct doc.web from XWikiDocument doc

Wrapped Exception: could not execute query @ <unknown template>[62,34]
        at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:157)
        at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1353)
        at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1314)
        at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:605)
        at sun.reflect.GeneratedMethodAccessor214.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: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:238)
        at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:152)
        at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1353)
        at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1314)
        at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:105)
        at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:158)
        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:117)
        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:233)
        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:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Unknown Source)

Brandon Esbach
Software Engineer
Wireless Systems Segment
Tyco Electronics
4 Eastgate Road
Eastgate
Little Island
Co. Cork
Ireland
Tel: +353-21-4808305
Email: esbachb@tycoelectronics.com