Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-5496

Hibernate proxy class not found in remote EJB call

    XMLWordPrintable

Details

    Description

      Prerequisites:

      1. A JPA entity A with a reference to a different JPA entity B. FetchType is FetchType.LAZY, e.g.

      @Entity
      public class A {
      @ManyToOne(fetch = FetchType.LAZY)
      private B refToB;
      }

      @Entity
      public class B {
      }

      2. A remote interface with methods passing an instance of A, .e.g.

      @Remote
      public interface ITest {
      A test1();

      void test2(A a);
      }

      3. A process calling test1() and then test2() on the remote interface like this:

      @EJB(lookup = "...")
      private ITest iTest;

      public void ITest()

      { final A a = iTest.test1(); iTest.test2(a); }

      }

      Error description: When calling test1() an instance of A is returned. This instance is valid and works as expected. The reference to B is a proxy (something like B_$$_javassist_2), which was expected because B was loaded lazily and was never accessed in the remote process before. When passing the instance of A back by calling test2(a) an exception of this type is raised:

      java.lang.ClassNotFoundException: B_$$_javassist_2 from [Module "deployment.x.ear.y_ejb.jar:main" from Service Module Loader]
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(Concurrent
      ClassLoader.java:468)

      It looks as if the proxy cannot be serialized or deserialized. The behavior is reproducible with different applications on different platforms. As soon as a Hibernate javassist proxy, which was received via a remote call, is passed back as an argument in another remote call (the remote process is the same in all calls) the exception is raised.
      The classloader settings are the standard JBoss settings.

      Attachments

        1. deployments.tar.gz
          7.51 MB
        2. server.log
          415 kB
        3. sources.tar.gz
          22 kB
        4. sources2.tar.gz
          94 kB
        5. test.sql
          3 kB

        Issue Links

          Activity

            People

              smarlow1@redhat.com Scott Marlow
              seimet Uwe Seimet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: