- Welcome to the BIM Guides Project
- Query Generator
Query Generator
Last modified by Sylvain MARIE on 2014-02-10
Failed to execute the [velocity] macro. Click on this message for details.
org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [{{html}} <form action =""> Generate form for class: <select name="classname"> #if($request.classname) #set($classname = $request.classname) #else #set($classname = "XWiki.XWikiUsers") #end #set($classes = $xwiki.classList) #foreach($classn in $classes) <option value="${classn}" #if($classname==$classn) selected #end>$classn</option> #end </select> <input type="submit" value="Go" /> </form> {{/html}} ## Code #set($query = $xwiki.createQueryFromRequest($classname)) #set($class = $xwiki.getDocument($classname).xWikiClass) #set($displayfields = $query.displayProperties) #set($fields = $xwiki.getDocument($classname).xWikiClass.propertyNames) #if($displayfields.size()==0) #set($displayfields = "") #end #set($mydoc = $xwiki.getDocument("Sandbox.Sandbox")) #set($ok = $mydoc.newObject($classname)) #set($ok = $mydoc.use($classname)) {{html clean=false}} <form action="" method="get"> <input type="hidden" name="query" value="1" /> <input type="hidden" name="classname" value="$classname" /> <table border="0"> #set($even = true) #foreach($field in $fields) #if($even==true) <tr> #end <td><b>$mydoc.displayPrettyName($field)</b></td><td>$xwiki.displaySearch($field, $classname, $query)</td> #if($even==false) </tr> #end #set($even = !$even) #end #if($even==false) </tr> #end <tr><td><b>Columns</b></td><td>$xwiki.displaySearchColumns($classname, $query)</td> <td><b>Order by</b></td><td>$xwiki.displaySearchOrder($classname, $query)</td></tr> </table> <input type="submit" value="Go" /> </form> #if($request.query) #if($request.order) #set($order=$request.order) #end #set($qplugin = $xwiki.parseGroovyFromPage("Macros.QueryGeneratorGroovy").getQueryPlugin($context)) #set($xwlquery = $qplugin.makeQuery($query)) #set($columns = []) #foreach($field in $displayfields) #set($ok = $columns.add($field.replaceAll("${classname}_",""))) #end #set($columns = $stringtool.join($columns,",")) <ul> <li><b>Query (xwql):</b> $xwlquery</li> <li><b>Columns:</b>$columns</li> <li><b>Macro:</b>{{query query="$xwlquery" class="$classname" columns="$columns" headers="1" links="0" actions="1" /}} </li> <ul> {{/html}} {{query query="$xwlquery" class="$classname" columns="$columns" headers="1" links="0" actions="1" /}} #end] at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:131) at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:50) at org.xwiki.rendering.macro.script.AbstractScriptMacro.evaluateBlock(AbstractScriptMacro.java:286) at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:182) at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:58) at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:269) at org.xwiki.rendering.internal.transformation.DefaultRenderingContext.transformInContext(DefaultRenderingContext.java:183) at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:94) at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:252) at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:125) at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:55) at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:96) at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:39) at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:113) at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:50) at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:67) at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:41) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1167) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1132) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1182) at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:682) at sun.reflect.GeneratedMethodAccessor390.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.doInvoke(UberspectImpl.java:395) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280) at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567) at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71) at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.xwiki.velocity.introspection.TryCatchDirective.render(TryCatchDirective.java:72) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:256) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:198) at com.xpn.xwiki.internal.template.InternalTemplateManager.evaluateContent(InternalTemplateManager.java:729) at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:627) at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:605) at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:571) at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:557) at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:65) at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1754) at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1732) at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:797) at sun.reflect.GeneratedMethodAccessor174.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.doInvoke(UberspectImpl.java:395) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280) at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:369) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:216) at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:311) at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:230) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:256) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:198) at com.xpn.xwiki.internal.template.InternalTemplateManager.evaluateContent(InternalTemplateManager.java:729) at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:627) at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:605) at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:571) at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:557) at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:65) at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1754) at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:180) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:422) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:180) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:115) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:127) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:66) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:137) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:868) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with id [xwiki:Macros.QueryGenerator] at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:224) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:198) at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:124) ... 129 more Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getClassList' in class com.xpn.xwiki.api.XWiki threw exception com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception while searching class list at 80008:xwiki:Macros.QueryGenerator[line 9, column 24] at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:223) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280) at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567) at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71) at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluateInternal(DefaultVelocityEngine.java:256) at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222) ... 131 more Caused by: com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception while searching class list at com.xpn.xwiki.store.XWikiHibernateStore.getClassList(XWikiHibernateStore.java:1940) at com.xpn.xwiki.store.XWikiCacheStore.getClassList(XWikiCacheStore.java:340) at com.xpn.xwiki.XWiki.getClassList(XWiki.java:1687) at com.xpn.xwiki.api.XWiki.getClassList(XWiki.java:491) at sun.reflect.GeneratedMethodAccessor819.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:142) at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:539) at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:198) ... 138 more Caused by: com.xpn.xwiki.XWikiException: Error number 3301 in 3: Exception while switching to database xwiki at com.xpn.xwiki.store.XWikiHibernateBaseStore.setDatabase(XWikiHibernateBaseStore.java:738) at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:911) at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:826) at com.xpn.xwiki.store.XWikiHibernateStore.getClassList(XWikiHibernateStore.java:1927) ... 147 more Caused by: org.hibernate.exception.GenericJDBCException: error executing work at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) at org.hibernate.impl.SessionImpl.doWork(SessionImpl.java:2001) at com.xpn.xwiki.store.XWikiHibernateBaseStore.executeSQL(XWikiHibernateBaseStore.java:752) at com.xpn.xwiki.store.XWikiHibernateBaseStore.setDatabase(XWikiHibernateBaseStore.java:721) ... 150 more Caused by: java.sql.SQLException: file input/output error: C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0_Tomcat8-XWiki\work\Catalina\localhost\ROOT/database/xwiki_db.log in statement [SET SCHEMA "PUBLIC"] at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source) at org.hsqldb.jdbc.JDBCStatement.execute(Unknown Source) at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:291) at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:291) at com.xpn.xwiki.store.XWikiHibernateBaseStore$1.execute(XWikiHibernateBaseStore.java:760) at org.hibernate.impl.SessionImpl.doWork(SessionImpl.java:1997) ... 152 more Caused by: org.hsqldb.HsqlException: file input/output error: C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0_Tomcat8-XWiki\work\Catalina\localhost\ROOT/database/xwiki_db.log at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.persist.Log.writeOtherStatement(Unknown Source) at org.hsqldb.persist.Logger.writeOtherStatement(Unknown Source) at org.hsqldb.StatementSession.execute(Unknown Source) at org.hsqldb.Session.executeCompiledStatement(Unknown Source) at org.hsqldb.Session.executeDirectStatement(Unknown Source) at org.hsqldb.Session.execute(Unknown Source) ... 158 more
Tags:
Created by Sylvain MARIE on 2014-02-10