[jboss-jira] [JBoss JIRA] (AS7-5496) Hibernate proxy class not found in remote EJB call

Scott Marlow (JIRA) jira-events at lists.jboss.org
Wed Sep 26 10:27:03 EDT 2012


    [ https://issues.jboss.org/browse/AS7-5496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721962#comment-12721962 ] 

Scott Marlow edited comment on AS7-5496 at 9/26/12 10:25 AM:
-------------------------------------------------------------

{quote}
SerializableProxy.readResolve returns a proxy object (no cnfe yet, just incorrect java sources ;).

Object passed to SerializableClass.callReadResolve is:
instance of org.hibernate.proxy.pojo.javassist.SerializableProxy
SerializableProxy contents:
PersistenceClass=de.seimet.photo.entity.Location
interfaces[0]=org.hibernate.proxy.HibernateProxy
getIdentifierMethodClass=null
setIdentifierMethodClass=null
getIdentifierMethodName=null
setIdentifierMethodName=null
setIdentifierMethodParams=null
componentIdType=null
entityName=de.seimet.photo.entity.Location
id="1"
readOnly=null

Thread call stack from the SerializableProxy.readResolve is below:

	  at org.hibernate.proxy.pojo.javassist.SerializableProxy.readResolve(SerializableProxy.java:91)
	  at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
	  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	  at java.lang.reflect.Method.invoke(Method.java:601)
	  at org.jboss.marshalling.reflect.SerializableClass.callReadResolve(SerializableClass.java:338)
	  at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:259)
	  at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:231)
	  at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:134)
	  at org.jboss.marshalling.cloner.SerializingCloner.cloneFields(SerializingCloner.java:348)
	  at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:309)
	  at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:253)
	  at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:134)
	  at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:267)
	  at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:258)
	  at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:230)
	  at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
	  at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:42)
	  at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
	  at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:125)
	  at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
	  at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
	  at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
	  at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
	  at $Proxy46.test1(Unknown Source:-1)
	  at de.seimet.photo.backing.ThumbnailBean.action(ThumbnailBean.java:27)
{quote}
                
      was (Author: smarlow):
    {quote}
SerializableProxy.readResolve returns a proxy object but we hit the ClassNotFoundException in org.jboss.marshalling.reflect.SerializableClass.callReadResolve()

Object passed to SerializableClass.callReadResolve is:
instance of org.hibernate.proxy.pojo.javassist.SerializableProxy
SerializableProxy contents:
PersistenceClass=de.seimet.photo.entity.Location
interfaces[0]=org.hibernate.proxy.HibernateProxy
getIdentifierMethodClass=null
setIdentifierMethodClass=null
getIdentifierMethodName=null
setIdentifierMethodName=null
setIdentifierMethodParams=null
componentIdType=null
entityName=de.seimet.photo.entity.Location
id="1"
readOnly=null

Thread call stack from the SerializableProxy.readResolve is below:

	  at org.hibernate.proxy.pojo.javassist.SerializableProxy.readResolve(SerializableProxy.java:91)
	  at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
	  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	  at java.lang.reflect.Method.invoke(Method.java:601)
	  at org.jboss.marshalling.reflect.SerializableClass.callReadResolve(SerializableClass.java:338)
	  at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:259)
	  at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:231)
	  at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:134)
	  at org.jboss.marshalling.cloner.SerializingCloner.cloneFields(SerializingCloner.java:348)
	  at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:309)
	  at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:253)
	  at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:134)
	  at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:267)
	  at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:258)
	  at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:230)
	  at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
	  at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:42)
	  at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
	  at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:125)
	  at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
	  at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
	  at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
	  at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
	  at $Proxy46.test1(Unknown Source:-1)
	  at de.seimet.photo.backing.ThumbnailBean.action(ThumbnailBean.java:27)
{quote}
                  
> Hibernate proxy class not found in remote EJB call
> --------------------------------------------------
>
>                 Key: AS7-5496
>                 URL: https://issues.jboss.org/browse/AS7-5496
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: JPA / Hibernate
>    Affects Versions: 7.1.1.Final
>         Environment: Java 1.6.0_35 and Java 1.7.0_07
> Mac OS X 10.8.1, Windows XP and Gentoo Linux with Kernel 3.5.3
>            Reporter: Uwe Seimet
>            Assignee: Scott Marlow
>         Attachments: deployments.tar.gz, server.log, sources.tar.gz, sources2.tar.gz, test.sql
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list