[jboss-user] [EJB 3.0] - Problem with LAZY relations and SerializableProxy

f.ulbricht@qualitype.de do-not-reply at jboss.com
Mon Dec 18 09:46:26 EST 2006


I have to entities, Person and Address, connected in this way:

in PersonEntityImpl:
@OneToMany(mappedBy = "person", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set getAddresses()

in AddressEntityImpl:
@ManyToOne(fetch = FetchType.LAZY, optional = false)
public PersonEntityImpl getPerson()

Creating and finding works fine, even updating a person is no problem. But when I update an address the server performs the change in the database correctly and then the invoked SessionBean method returns the merged address entity. On client side the exception below occurs. When changing to EAGER everything works fine (but this is not a solution). It seams the problem occurs while de-serializing the entity with a lazy attribute.

I'v read a lot of this and similar problems (like http://jira.jboss.com/jira/browse/EJBTHREE-440). There are other projects of mine where I have the same exception in more complex entity relations. At this moment this is a real "stopping" issue, because I have no solution at all.

I have a JBoss 4.0.5 GA, installed with the JEMS installer 1.2.0 CR1. After patching to EJB3 RC9 the problem still remains.

After trying nearly all combinations of annotations, classpath entries and so on, there is one big question: Could this still be the same problem as reported earlier from other users (should be fixed) or am I just to stupid to configure my JBoss?

java.lang.reflect.UndeclaredThrowableException
	at $Proxy6.updateAddress(Unknown Source)
	at com.qualitype.tutorial.test.AddressManagerTest.testUpdateAddress(AddressManagerTest.java:97)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
	at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
	at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
	at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
	at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.rmi.MarshalException: Failed to communicate.  Problem during marshalling/unmarshalling; nested exception is: 
	java.lang.ClassCastException: cannot assign instance of org.hibernate.proxy.pojo.javassist.SerializableProxy to field com.qualitype.tutorial.ejb.entity.AddressEntityImpl.person of type com.qualitype.tutorial.ejb.entity.PersonEntityImpl in instance of com.qualitype.tutorial.ejb.entity.AddressEntityImpl
	at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:306)
	at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
	at org.jboss.remoting.Client.invoke(Client.java:525)
	at org.jboss.remoting.Client.invoke(Client.java:488)
	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
	... 22 more
Caused by: java.lang.ClassCastException: cannot assign instance of org.hibernate.proxy.pojo.javassist.SerializableProxy to field com.qualitype.tutorial.ejb.entity.AddressEntityImpl.person of type com.qualitype.tutorial.ejb.entity.PersonEntityImpl in instance of com.qualitype.tutorial.ejb.entity.AddressEntityImpl
	at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(Unknown Source)
	at java.io.ObjectStreamClass.setObjFieldValues(Unknown Source)
	at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
	at java.io.ObjectInputStream.readSerialData(Unknown Source)
	at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
	at java.io.ObjectInputStream.readObject0(Unknown Source)
	at java.io.ObjectInputStream.readObject(Unknown Source)
	at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:122)
	at java.io.ObjectInputStream.readExternalData(Unknown Source)
	at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
	at java.io.ObjectInputStream.readObject0(Unknown Source)
	at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
	at java.io.ObjectInputStream.readSerialData(Unknown Source)
	at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
	at java.io.ObjectInputStream.readObject0(Unknown Source)
	at java.io.ObjectInputStream.readObject(Unknown Source)
	at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
	at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
	at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
	... 34 more



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994689#3994689

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994689



More information about the jboss-user mailing list