Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-3758

NoClassDefFoundError: org/jboss/seam/intercept/Proxy when Seam Component is an EJB in another module

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.0.2.GA, 2.0.2.SP1, 2.1.0.GA, 2.1.0.SP1
    • Fix Version/s: 2.1.1.CR2
    • Component/s: Core
    • Labels:
      None
    • Environment:

      JBoss AS 4.2.2, Seam 2.0.2.GA, 2.0.2.SP1, 2.1.0.GA, 2.1.0.SP1

      Description

      I have all my backing beans in the web application (java bean components). My business logic is inside EJBs in a module which has no reference to Seam whatsoever. So, the EAR class loader has no reference to Seam classes, Seam's jar are only in my web application (WEB-INF/lib).
      After some debugging, I saw that seam (2.0.2.SP1) passes an Array of interfaces to the ProxyFactory class. ProxyFactory gets the ClassLoader from the first class in the array. When the first class in the array is either Proxy or Instance, everything works fine. When the EJB interface is the first element on the array (happens after a few restarts of JBoss), ProxyFactory gets its ClassLoader, the EAR ClassLoader, which, as metioned before, doesn't "know" about Seam.

      I think a simple solution would be change the method createProxyFactory in the Component class to the following:

      Set<Class> interfaces = new TreeSet<Class>(); // instead of a HashSet, to guarantee the order of the elements
      // so these classes the first elements on the array
      interfaces.add(Instance.class);
      interfaces.add(Proxy.class);
      if ( type.isSessionBean() )

      { interfaces.addAll(businessInterfaces); }

      else

      { interfaces.add(HttpSessionActivationListener.class); interfaces.add(Mutable.class); }

      ProxyFactory factory = new ProxyFactory();
      // excluding this part, which was included in 2.1.0, but didn't really solved the problem
      /*{
      @Override
      protected ClassLoader getClassLoader()

      { return beanClass.getClassLoader(); }

      };*/

      A full description of the problem can be found at the forum location above.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  pmuir Pete Muir
                  Reporter:
                  andrenpaes Andre Rodrigues
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: