Cocoon 3
  1. Cocoon 3
  2. COCOON3-34

Attaching an aspect to "org.apache.cocoon.sitemap.node.Sitemap" leads to a ClassCastException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0-alpha-2
    • Component/s: cocoon-sitemap
    • Labels:
      None

      Description

      I tried to attach an around-aspect for every node:

      @Around("execution(* invoke(..)) && within(org.apache.cocoon.sitemap.node.*)")

      This led to a ClassCastException for the first sitemap. (see attached logfile)
      After excluding sitemap from my aspect, everything works just fine:

      @Around("execution(* invoke(..)) && within(org.apache.cocoon.sitemap.node.* && !org.apache.cocoon.sitemap.node.Sitemap)")

      Tested with cocoon-sample.
      1. cocoon.log
        8 kB
        Andreas Pinter

        Activity

        Hide
        Jörg Heinicke added a comment -
        This is a known issue with proxying as explained here: http://insufficientinformation.blogspot.com/2007/12/spring-dynamic-proxies-vs-cglib-proxies.html. Either Cocoon has to be changed to not rely on class but use interfaces or you can switch to CGLib proxies.
        Show
        Jörg Heinicke added a comment - This is a known issue with proxying as explained here: http://insufficientinformation.blogspot.com/2007/12/spring-dynamic-proxies-vs-cglib-proxies.html . Either Cocoon has to be changed to not rely on class but use interfaces or you can switch to CGLib proxies.
        Hide
        Reinhard Poetz added a comment -
        I've just applied (rev 769069) a patch to XMLSitemapServlet. Can you please check if this solves your problem? Thanks!
        Show
        Reinhard Poetz added a comment - I've just applied (rev 769069) a patch to XMLSitemapServlet. Can you please check if this solves your problem? Thanks!
        Hide
        Jörg Heinicke added a comment -
        I'm not sure this fixes the class cast in SitemapBuilder$SitemapHandler as seen in the log file. There an explicit cast to Sitemap is done:

        this.sitemap = (Sitemap) SitemapBuilder.this.createSitemapNode(localName, null);

        This won't work with dynamic proxies.
        Show
        Jörg Heinicke added a comment - I'm not sure this fixes the class cast in SitemapBuilder$SitemapHandler as seen in the log file. There an explicit cast to Sitemap is done: this.sitemap = (Sitemap) SitemapBuilder.this.createSitemapNode(localName, null); This won't work with dynamic proxies.
        Hide
        Reinhard Poetz added a comment -
        I've applied another patch to get rid of (hopefully this time) all direct usages of Sitemap. Thanks for spotting Jörg!
        Show
        Reinhard Poetz added a comment - I've applied another patch to get rid of (hopefully this time) all direct usages of Sitemap. Thanks for spotting Jörg!
        Hide
        Andreas Pinter added a comment -
        for my specific case it works now.
        No unexpect Exception any more
        Show
        Andreas Pinter added a comment - for my specific case it works now. No unexpect Exception any more

          People

          • Assignee:
            Reinhard Poetz
            Reporter:
            Andreas Pinter
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development