Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-20146

Don't fail the UI when a rogue macro is installed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Solved By
    • Major
    • 15.0-rc-1
    • 14.7
    • CKEditor
    • None
    • Unknown

    Description

      See https://forum.xwiki.org/t/failed-to-retrieve-the-list-of-available-macros-failed-to-execute-the-velocity-macro/11055/

      To reproduce:

      • turn off docker
      • install kroki macro
      • edit in wysiwyg and try to add a macro
      ...
      Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getMacroDescriptors' in  class org.xwiki.rendering.script.RenderingScriptService threw exception org.xwiki.rendering.macro.MacroLookupException: Failed to lookup Macros at xwiki:CKEditor.MacroService[line 39, column 47]
      	at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:308)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:235)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
      	at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:704)
      	at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:75)
      	at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:242)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
      	at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:218)
      	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:331)
      	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:261)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:171)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
      	at org.apache.velocity.runtime.parser.node.ASTElseIfStatement.render(ASTElseIfStatement.java:108)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:190)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
      	at org.apache.velocity.Template.merge(Template.java:358)
      	at org.apache.velocity.Template.merge(Template.java:262)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:280)
      	... 221 more
      Caused by: org.xwiki.rendering.macro.MacroLookupException: Failed to lookup Macros
      	at org.xwiki.rendering.internal.macro.DefaultMacroManager.getMacroIds(DefaultMacroManager.java:89)
      	at org.xwiki.rendering.script.RenderingScriptService.getMacroDescriptors(RenderingScriptService.java:271)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221)
      	... 239 more
      Caused by: org.xwiki.component.manager.ComponentLookupException: Failed to lookup component with type [interface org.xwiki.rendering.macro.Macro] and hint [kroki]
      	at org.xwiki.component.embed.EmbeddableComponentManager.getInstanceMap(EmbeddableComponentManager.java:245)
      	at org.xwiki.component.embed.EmbeddableComponentManager.getInstanceMap(EmbeddableComponentManager.java:253)
      	at org.xwiki.component.internal.multi.DelegateComponentManager.getInstanceMap(DelegateComponentManager.java:95)
      	at org.xwiki.component.internal.multi.DelegateComponentManager.getInstanceMap(DelegateComponentManager.java:95)
      	at org.xwiki.component.internal.multi.DelegateComponentManager.getInstanceMap(DelegateComponentManager.java:95)
      	at org.xwiki.component.internal.multi.DelegateComponentManager.getInstanceMap(DelegateComponentManager.java:95)
      	at org.xwiki.component.internal.multi.DelegateComponentManager.getInstanceMap(DelegateComponentManager.java:95)
      	at org.xwiki.rendering.internal.macro.DefaultMacroManager.getMacroIds(DefaultMacroManager.java:87)
      	... 247 more
      Caused by: org.xwiki.component.manager.ComponentLookupException: Failed to lookup component [org.xwiki.contrib.kroki.internal.rendrer.KrokiDiagramRenderer] identified by type [interface org.xwiki.contrib.kroki.renderer.DiagramRenderer] and hint [default]
      	at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:204)
      	at org.xwiki.component.embed.EmbeddableComponentManager.getDependencyInstance(EmbeddableComponentManager.java:406)
      	at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:355)
      	at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
      	at org.xwiki.component.embed.EmbeddableComponentManager.getInstanceMap(EmbeddableComponentManager.java:242)
      	... 254 more
      Caused by: org.xwiki.component.phase.InitializationException: Failed to initialize the Docker container for diagram rendering.
      	at org.xwiki.contrib.kroki.internal.rendrer.KrokiDiagramRenderer.initializeKrokiDockerContainer(KrokiDiagramRenderer.java:151)
      	at org.xwiki.contrib.kroki.internal.rendrer.KrokiDiagramRenderer.initializeKrokiComponent(KrokiDiagramRenderer.java:174)
      	at org.xwiki.contrib.kroki.internal.rendrer.KrokiDiagramRenderer.initialize(KrokiDiagramRenderer.java:76)
      	at org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)
      	at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:365)
      	at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)
      	at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)
      	... 258 more
      Caused by: java.lang.RuntimeException: java.io.IOException: com.sun.jna.LastErrorException: [2] No such file or directory
      	at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:195)
      	at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:9)
      	at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
      	at com.github.dockerjava.core.DefaultInvocationBuilder.get(DefaultInvocationBuilder.java:202)
      	at com.github.dockerjava.core.DefaultInvocationBuilder.get(DefaultInvocationBuilder.java:74)
      	at com.github.dockerjava.core.exec.ListContainersCmdExec.execute(ListContainersCmdExec.java:44)
      	at com.github.dockerjava.core.exec.ListContainersCmdExec.execute(ListContainersCmdExec.java:15)
      	at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
      	at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
      	at org.xwiki.contrib.kroki.internal.docker.ContainerManager.exec(ContainerManager.java:310)
      	at org.xwiki.contrib.kroki.internal.docker.ContainerManager.maybeReuseContainerByName(ContainerManager.java:96)
      	at org.xwiki.contrib.kroki.internal.rendrer.KrokiDiagramRenderer.initializeKrokiDockerContainer(KrokiDiagramRenderer.java:135)
      	... 264 more
      Caused by: java.io.IOException: com.sun.jna.LastErrorException: [2] No such file or directory
      	at com.github.dockerjava.transport.DomainSocket.<init>(DomainSocket.java:63)
      	at com.github.dockerjava.transport.LinuxDomainSocket.<init>(LinuxDomainSocket.java:41)
      	at com.github.dockerjava.transport.DomainSocket.get(DomainSocket.java:140)
      	at com.github.dockerjava.transport.UnixSocket.get(UnixSocket.java:29)
      	at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl$2.createSocket(ApacheDockerHttpClientImpl.java:153)
      	at org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:125)
      	at org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:407)
      	at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:168)
      	at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:178)
      	at org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:136)
      	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
      	at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
      	at org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:165)
      	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
      	at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
      	at org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:96)
      	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
      	at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
      	at org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:133)
      	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
      	at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
      	at org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:115)
      	at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
      	at org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:179)
      	at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:67)
      	at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:191)
      	... 275 more
      Caused by: com.sun.jna.LastErrorException: [2] No such file or directory
      	at com.github.dockerjava.transport.LinuxDomainSocket.connect(Native Method)
      	at com.github.dockerjava.transport.LinuxDomainSocket.connect(LinuxDomainSocket.java:49)
      	at com.github.dockerjava.transport.DomainSocket.open(DomainSocket.java:69)
      	at com.github.dockerjava.transport.DomainSocket.<init>(DomainSocket.java:59)
      	... 300 more
      

      Attachments

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: