Hi there
I tried to display an editor field from an object on the current page (Class defined in another page) in the current page. This works fine with the following velocity code (found on the Internet):
#set($sRef=$doc.getObject(“NetSuccess Internal.Playground.Structured Data in xWiki.xData-Test2.xData-Test2-Class.ClassDefinition.WebHome”,false))
$sRef.display(“EditorField”,$context.action)
This works fine to display the content of the EditorField in the current page and to use the “Inline Form” editor to modify it’s content. The good old Wiki Editor also works since it simply displays the markup code.
But loading the WYSIWYG - in my case CKEditor - throws:
> Error number 4001 in 4: Error while evaluating velocity template edit.vm
>
> Error number 4001 in 4: Error while evaluating velocity template edit.vm
> com.xpn.xwiki.XWikiException: Error number 4001 in 4: Error while evaluating velocity template edit.vm
> at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:2359)
> at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:179)
> at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:513)
> at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:215)
> 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:624)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:112)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:109)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
> at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
> at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
> at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
> at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with id [/skins/flamingo/edit.vm]
> at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:227)
> at com.xpn.xwiki.render.DefaultVelocityManager.evaluate(DefaultVelocityManager.java:358)
> at com.xpn.xwiki.internal.template.InternalTemplateManager.evaluateContent(InternalTemplateManager.java:874)
> at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:750)
> at com.xpn.xwiki.internal.template.InternalTemplateManager.lambda$renderFromSkin$0(InternalTemplateManager.java:725)
> at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
> at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:724)
> at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:703)
> at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:689)
> at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:78)
> at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:2354)
> ... 43 more
> Caused by: java.util.EmptyStackException
> at java.util.Stack.peek(Stack.java:102)
> at java.util.Stack.pop(Stack.java:84)
> at org.apache.velocity.context.InternalContextBase.popCurrentMacroName(InternalContextBase.java:140)
> at com.xpn.xwiki.render.ScriptVelocityContext.popCurrentMacroName(ScriptVelocityContext.java:37)
> at org.apache.velocity.context.InternalContextAdapterImpl.popCurrentMacroName(InternalContextAdapterImpl.java:163)
> at org.apache.velocity.context.ChainedInternalContextAdapter.popCurrentMacroName(ChainedInternalContextAdapter.java:168)
> at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:217)
> 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.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.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:259)
> at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:222)
> ... 53 more
Since the code snipped is rather old and the display class was changed (inline changed to edit and such), maybe I missed something here - or it is a bug. Any hint to further analyze the source of the error?
Thank you and happy new year!