Cocoon
  1. Cocoon
  2. COCOON-1939

Stack overflow when inheriting from block that alread inherits from another one

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.2
    • Labels:
      None

      Description

      There are problems with the following scenario: I have one Block A, another one B that has A as super-block defined and a third one C that has B as super-block defined.

      The super-relation between B and A works ok, but if you start in C, then forward to B, which in turn wants to forward to block A (all via the block:super: protocol), a stack overflow happens. It looks like he always thinks he is in C, so that block:super: from B will always get to B, thus creating an endless loop.

        Issue Links

          Activity

          Hide
          Grzegorz Kossakowski added a comment -
          Fixed in r572015.
          Show
          Grzegorz Kossakowski added a comment - Fixed in r572015.
          Hide
          Alexander Klimetschek added a comment -
          Now it behaves like in the beginning, 2-level inheritance does not work. The polymorphic calls do work again.

          I resolved the problem by renaming the "top-level" connection from super to something else, since I don't need polymorphism there. As long as I don't need that, the current system is ok.

          I will add some examples soon and add a comment / patch here.
          Show
          Alexander Klimetschek added a comment - Now it behaves like in the beginning, 2-level inheritance does not work. The polymorphic calls do work again. I resolved the problem by renaming the "top-level" connection from super to something else, since I don't need polymorphism there. As long as I don't need that, the current system is ok. I will add some examples soon and add a comment / patch here.
          Hide
          Daniel Fagerstrom added a comment -
          I found the problem with the latest patch and have hopefully solved that with a new patch. There still might be some problems left though. For example I don't think inheritance works in three levels. And also the inheritance of properties need some more review. I'll return to it.

          I would appriciate if you could contribute extensions to the cocoon-blocks-fw-sample that illustrates the cases that you have had problems with this far. in a later step we should build unit test cases from the examples.
          Show
          Daniel Fagerstrom added a comment - I found the problem with the latest patch and have hopefully solved that with a new patch. There still might be some problems left though. For example I don't think inheritance works in three levels. And also the inheritance of properties need some more review. I'll return to it. I would appriciate if you could contribute extensions to the cocoon-blocks-fw-sample that illustrates the cases that you have had problems with this far. in a later step we should build unit test cases from the examples.
          Hide
          Alexander Klimetschek added a comment -
          With this fix polymorphic calls no longer work. Eg. (with A <-- super -- B), calling B, then super to A, then calling block:/polymorphic.xml will now call A polymorphic.xml and not the "overridden" one in block B.
          Show
          Alexander Klimetschek added a comment - With this fix polymorphic calls no longer work. Eg. (with A <-- super -- B), calling B, then super to A, then calling block:/polymorphic.xml will now call A polymorphic.xml and not the "overridden" one in block B.
          Hide
          Daniel Fagerstrom added a comment -
          Forgot to mention that I commited the fix.
          Show
          Daniel Fagerstrom added a comment - Forgot to mention that I commited the fix.
          Hide
          Daniel Fagerstrom added a comment -
          The BlockContext wasn't pushed at the BlockCallStack when doing a polymorphic call through the block protocol, like block:/foo in your example, this made subsequent block protocol call be called relative to the wrong context of the super block A instead of relative the context of B.

          Please check if it solves the problem for you.
          Show
          Daniel Fagerstrom added a comment - The BlockContext wasn't pushed at the BlockCallStack when doing a polymorphic call through the block protocol, like block:/foo in your example, this made subsequent block protocol call be called relative to the wrong context of the super block A instead of relative the context of B. Please check if it solves the problem for you.
          Hide
          Alexander Klimetschek added a comment -
          The cocoon:/ protocol is not the problem. Now block:super: fails in one case. I have block A <-- super <-- B. Now B calls super, then A calls block:/foo, this is handled by B (which has a foo-matcher), which in turn wants to call block:super:/dforms-model-directory.xml, which fails. So it goes up, down and the follwing up does not work.

          The simplified and annotated stacktrace:

          javax.servlet.ServletException: No dispatcher for block:super:/dforms-model-directory.xml
          at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:114)
          at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51)
          at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462)
          at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298)
          at org.apache.cocoon.sitemap.DefaultContentAggregator.generate(DefaultContentAggregator.java:123)
          (Block B)
          ...
          at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436)
          at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:115)
          at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51)
          at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462)
          at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298)
          at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116)
          (Block A)
          ...
          at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436)
          at org.apache.cocoon.blocks.BlockContext$NamedDispatcher.forward(BlockContext.java:394)
          at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:115)
          at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51)
          at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462)
          at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298)
          at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116)
          (Block B)
          ...
          at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436)
          at org.apache.cocoon.blocks.BlockServlet.service(BlockServlet.java:125)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.cocoon.blocks.DispatcherServlet.service(DispatcherServlet.java:124)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.cocoon.bootstrap.servlet.ShieldingServlet.service(ShieldingServlet.java:106)
          at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:443)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1050)
          at org.apache.cocoon.servlet.multipart.MultipartFilter.doFilter(MultipartFilter.java:104)
          at org.apache.cocoon.bootstrap.servlet.ShieldingServletFilter.doFilter(ShieldingServletFilter.java:50)
          ...

          The full stacktrace:

          javax.servlet.ServletException: No dispatcher for block:super:/dforms-model-directory.xml
          at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:114)
          at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51)
          at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462)
          at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298)
          at org.apache.cocoon.sitemap.DefaultContentAggregator.generate(DefaultContentAggregator.java:123)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy11.generate(Unknown Source)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:537)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:437)
          at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy2.process(Unknown Source)
          at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:134)
          at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:55)
          at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:87)
          at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
          at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:152)
          at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
          at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
          at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:239)
          at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:170)
          at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:228)
          at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436)
          at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:115)
          at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51)
          at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462)
          at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298)
          at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116)
          at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy3.generate(Unknown Source)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:537)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:722)
          at sun.reflect.GeneratedMethodAccessor71.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy2.process(Unknown Source)
          at org.apache.cocoon.components.source.impl.SitemapSource.toSAX(SitemapSource.java:344)
          at org.apache.cocoon.components.source.SourceUtil.toSAX(SourceUtil.java:97)
          at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:293)
          at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116)
          at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy3.generate(Unknown Source)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:537)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:722)
          at sun.reflect.GeneratedMethodAccessor71.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy2.process(Unknown Source)
          at org.apache.cocoon.components.source.impl.SitemapSource.toSAX(SitemapSource.java:344)
          at org.apache.cocoon.components.source.SourceUtil.toSAX(SourceUtil.java:97)
          at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:293)
          at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116)
          at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy3.generate(Unknown Source)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:537)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:437)
          at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy2.process(Unknown Source)
          at org.apache.cocoon.components.source.impl.SitemapSource.getInputStream(SitemapSource.java:198)
          at org.apache.cocoon.reading.ResourceReader.generate(ResourceReader.java:329)
          at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy8.generate(Unknown Source)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processReader(AbstractProcessingPipeline.java:649)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:429)
          at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy2.process(Unknown Source)
          at org.apache.cocoon.components.treeprocessor.sitemap.ReadNode.invoke(ReadNode.java:95)
          at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:55)
          at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:87)
          at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
          at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:152)
          at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
          at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
          at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:239)
          at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:170)
          at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:228)
          at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436)
          at org.apache.cocoon.blocks.BlockContext$NamedDispatcher.forward(BlockContext.java:394)
          at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:115)
          at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51)
          at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462)
          at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298)
          at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116)
          at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy3.generate(Unknown Source)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:537)
          at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:437)
          at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349)
          at $Proxy2.process(Unknown Source)
          at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:134)
          at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
          at org.apache.cocoon.components.treeprocessor.sitemap.SwitchSelectNode.invoke(SwitchSelectNode.java:88)
          at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
          at org.apache.cocoon.components.treeprocessor.ContainerNode.invoke(ContainerNode.java:37)
          at org.apache.cocoon.components.treeprocessor.CategoryNode.invokeByName(CategoryNode.java:65)
          at org.apache.cocoon.components.treeprocessor.sitemap.CallNode.invoke(CallNode.java:83)
          at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:55)
          at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:87)
          at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
          at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:152)
          at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
          at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
          at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:239)
          at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:170)
          at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:228)
          at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436)
          at org.apache.cocoon.blocks.BlockServlet.service(BlockServlet.java:125)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.cocoon.blocks.DispatcherServlet.service(DispatcherServlet.java:124)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
          at org.apache.cocoon.bootstrap.servlet.ShieldingServlet.service(ShieldingServlet.java:106)
          at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:443)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1050)
          at org.apache.cocoon.servlet.multipart.MultipartFilter.doFilter(MultipartFilter.java:104)
          at org.apache.cocoon.bootstrap.servlet.ShieldingServletFilter.doFilter(ShieldingServletFilter.java:50)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1041)
          at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:354)
          at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:226)
          at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:615)
          at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
          at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123)
          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
          at org.mortbay.jetty.Server.handle(Server.java:269)
          at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:430)
          at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:678)
          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:492)
          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:199)
          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:339)
          at org.mortbay.jetty.nio.HttpChannelEndPoint.run(HttpChannelEndPoint.java:270)
          at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
          Show
          Alexander Klimetschek added a comment - The cocoon:/ protocol is not the problem. Now block:super: fails in one case. I have block A <-- super <-- B. Now B calls super, then A calls block:/foo, this is handled by B (which has a foo-matcher), which in turn wants to call block:super:/dforms-model-directory.xml, which fails. So it goes up, down and the follwing up does not work. The simplified and annotated stacktrace: javax.servlet.ServletException: No dispatcher for block:super:/dforms-model-directory.xml at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:114) at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51) at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462) at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298) at org.apache.cocoon.sitemap.DefaultContentAggregator.generate(DefaultContentAggregator.java:123) (Block B) ... at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436) at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:115) at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51) at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462) at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298) at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116) (Block A) ... at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436) at org.apache.cocoon.blocks.BlockContext$NamedDispatcher.forward(BlockContext.java:394) at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:115) at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51) at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462) at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298) at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116) (Block B) ... at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436) at org.apache.cocoon.blocks.BlockServlet.service(BlockServlet.java:125) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.cocoon.blocks.DispatcherServlet.service(DispatcherServlet.java:124) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.cocoon.bootstrap.servlet.ShieldingServlet.service(ShieldingServlet.java:106) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:443) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1050) at org.apache.cocoon.servlet.multipart.MultipartFilter.doFilter(MultipartFilter.java:104) at org.apache.cocoon.bootstrap.servlet.ShieldingServletFilter.doFilter(ShieldingServletFilter.java:50) ... The full stacktrace: javax.servlet.ServletException: No dispatcher for block:super:/dforms-model-directory.xml at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:114) at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51) at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462) at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298) at org.apache.cocoon.sitemap.DefaultContentAggregator.generate(DefaultContentAggregator.java:123) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy11.generate(Unknown Source) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:537) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:437) at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy2.process(Unknown Source) at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:134) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:55) at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:87) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77) at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:152) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77) at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93) at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:239) at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:170) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:228) at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436) at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:115) at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51) at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462) at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298) at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116) at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy3.generate(Unknown Source) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:537) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:722) at sun.reflect.GeneratedMethodAccessor71.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy2.process(Unknown Source) at org.apache.cocoon.components.source.impl.SitemapSource.toSAX(SitemapSource.java:344) at org.apache.cocoon.components.source.SourceUtil.toSAX(SourceUtil.java:97) at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:293) at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116) at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy3.generate(Unknown Source) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:537) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:722) at sun.reflect.GeneratedMethodAccessor71.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy2.process(Unknown Source) at org.apache.cocoon.components.source.impl.SitemapSource.toSAX(SitemapSource.java:344) at org.apache.cocoon.components.source.SourceUtil.toSAX(SourceUtil.java:97) at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:293) at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116) at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy3.generate(Unknown Source) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:537) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:437) at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy2.process(Unknown Source) at org.apache.cocoon.components.source.impl.SitemapSource.getInputStream(SitemapSource.java:198) at org.apache.cocoon.reading.ResourceReader.generate(ResourceReader.java:329) at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy8.generate(Unknown Source) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processReader(AbstractProcessingPipeline.java:649) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:429) at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy2.process(Unknown Source) at org.apache.cocoon.components.treeprocessor.sitemap.ReadNode.invoke(ReadNode.java:95) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:55) at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:87) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77) at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:152) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77) at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93) at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:239) at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:170) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:228) at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436) at org.apache.cocoon.blocks.BlockContext$NamedDispatcher.forward(BlockContext.java:394) at org.apache.cocoon.blocks.BlockConnection.getInputStream(BlockConnection.java:115) at org.apache.cocoon.blocks.components.BlockSource.getInputStream(BlockSource.java:51) at org.apache.cocoon.components.source.SourceUtil.getInputSource(SourceUtil.java:462) at org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:298) at org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:116) at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy3.generate(Unknown Source) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:537) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:437) at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.cocoon.core.container.spring.avalon.PoolableFactoryBean$ProxyHandler.invoke(PoolableFactoryBean.java:349) at $Proxy2.process(Unknown Source) at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:134) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77) at org.apache.cocoon.components.treeprocessor.sitemap.SwitchSelectNode.invoke(SwitchSelectNode.java:88) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77) at org.apache.cocoon.components.treeprocessor.ContainerNode.invoke(ContainerNode.java:37) at org.apache.cocoon.components.treeprocessor.CategoryNode.invokeByName(CategoryNode.java:65) at org.apache.cocoon.components.treeprocessor.sitemap.CallNode.invoke(CallNode.java:83) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:55) at org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:87) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77) at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:152) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77) at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93) at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:239) at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:170) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:228) at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:123) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.cocoon.blocks.BlockContext$PathDispatcher.forward(BlockContext.java:436) at org.apache.cocoon.blocks.BlockServlet.service(BlockServlet.java:125) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.cocoon.blocks.DispatcherServlet.service(DispatcherServlet.java:124) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.cocoon.bootstrap.servlet.ShieldingServlet.service(ShieldingServlet.java:106) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:443) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1050) at org.apache.cocoon.servlet.multipart.MultipartFilter.doFilter(MultipartFilter.java:104) at org.apache.cocoon.bootstrap.servlet.ShieldingServletFilter.doFilter(ShieldingServletFilter.java:50) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1041) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:354) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:226) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:615) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141) at org.mortbay.jetty.Server.handle(Server.java:269) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:430) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:678) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:492) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:199) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:339) at org.mortbay.jetty.nio.HttpChannelEndPoint.run(HttpChannelEndPoint.java:270) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
          Hide
          Alexander Klimetschek added a comment -
          It looks like the "cocoon:/" protocol does no longer work with this fix, or maybe is now handled in the wrong context. Is that possible?
          Show
          Alexander Klimetschek added a comment - It looks like the "cocoon:/" protocol does no longer work with this fix, or maybe is now handled in the wrong context. Is that possible?
          Hide
          Daniel Fagerstrom added a comment -
          Implemented the fix described above. Not much testing though. Please check that your usecase works, and close the issue if that is the case.
          Show
          Daniel Fagerstrom added a comment - Implemented the fix described above. Not much testing though. Please check that your usecase works, and close the issue if that is the case.
          Hide
          Daniel Fagerstrom added a comment -
          Thanks for spotting this subtle bug.

          The call mechanism for inheritance uses a stack. Say that you have an inheritance B->A (A is super block to B). If you call an uri in B, "block:B:/foo", the block context for B will be pushed on the BlockCallStack. Then say that "/foo" isn't defined in block B, in this case it will be called in the super block A instead (the super block is found through the connection map element with the name "super"). But when a super block is called the block context is *not* pushed, so the block context of block B still is on the top of the stack.

          Say then that while evaluating "/foo", block A do a polymorphic call "block:/bar". Such calls are always done relative the block context on the top of the stack i.e. the context of block B. So "/bar" will first be evaluated in block B and if not foun d there in its super block A.

          This far everything work as it should even for the case you described above C -> B -> A. Now the problem is that "block:super:/foo" is evaluated relative the top of the call stack. instead of relative the currently called blocks context. This happens to work in the case of inheritance in one step (B->A), as if you call super in the block B, the current block and the block on the call stack is the same: B.

          But in the case you described above it will not work as B will call its super block relative C rather than it self, and thus get into an infinite loop as you experienced.

          What needs to be done to solve this problem is to push all called blocks contexts on the stack and mark the super calls in some way. Then a super call should be done relative the top block context, and other (polymorphic) calls should be made relative to the top *non* super call block context.
          Show
          Daniel Fagerstrom added a comment - Thanks for spotting this subtle bug. The call mechanism for inheritance uses a stack. Say that you have an inheritance B->A (A is super block to B). If you call an uri in B, "block:B:/foo", the block context for B will be pushed on the BlockCallStack. Then say that "/foo" isn't defined in block B, in this case it will be called in the super block A instead (the super block is found through the connection map element with the name "super"). But when a super block is called the block context is *not* pushed, so the block context of block B still is on the top of the stack. Say then that while evaluating "/foo", block A do a polymorphic call "block:/bar". Such calls are always done relative the block context on the top of the stack i.e. the context of block B. So "/bar" will first be evaluated in block B and if not foun d there in its super block A. This far everything work as it should even for the case you described above C -> B -> A. Now the problem is that "block:super:/foo" is evaluated relative the top of the call stack. instead of relative the currently called blocks context. This happens to work in the case of inheritance in one step (B->A), as if you call super in the block B, the current block and the block on the call stack is the same: B. But in the case you described above it will not work as B will call its super block relative C rather than it self, and thus get into an infinite loop as you experienced. What needs to be done to solve this problem is to push all called blocks contexts on the stack and mark the super calls in some way. Then a super call should be done relative the top block context, and other (polymorphic) calls should be made relative to the top *non* super call block context.

            People

            • Assignee:
              Grzegorz Kossakowski
              Reporter:
              Alexander Klimetschek
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development