2 Replies Latest reply on Mar 8, 2007 4:35 PM by Dustin Norlander

    Tree  component + Seam = classcastexception?

    Dustin Norlander Apprentice

      Hi,

      I have just tried to get the tree example to work in seam and I get a ClassCastException on the library class. I thought I read somewhere that there were classloading problems with the tree and seam? If so, is there a work around?

      thanks,
      Dustin

        • 1. Re: Tree  component + Seam = classcastexception?
          Stuart Robertson Novice

           

          "dustismo" wrote:

          I have just tried to get the tree example to work in seam and I get a ClassCastException on the library class. I thought I read somewhere that there were classloading problems with the tree and seam? If so, is there a work around?


          Let me guess, you're deploying an ear file? It's not actually a seam problem, it's a consequence of J2EE classloaders and how RichFaces is currently packaged. What they really should do is break out interfaces and classes which your seam logic needs to reference (TreeNode, etc.) into a separate jar. This would be loaded in the ear classloader, and the rest of the RichFaces jar would be loaded exclusively by the web classloader.

          What's I suspect is happening (though you didn't provide many details) is that you're loading RichFaces in both classloaders. And the same class loaded from 2 different classloaders will not be equal according to instanceof.

          The workaround Gavin suggested for this - though it was in the context of the same issue for IceFaces - is to modify the jboss server config to use a shared classloader. Basically breaking the J2EE classloader structure as a workaround until the jar is broken out into two pieces. It worked for me, though it certainly isn't ideal, and is jboss-specific. Here's the post where I think it was discussed: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=94822&postdays=0&postorder=asc&start=20

          • 2. Re: Tree  component + Seam = classcastexception?
            Dustin Norlander Apprentice

            That was exactly it. thanks!

            -Dustin