Can not get Collection field in client
jkimber Aug 3, 2003 10:42 PMHi, I create two EntityBean StudentBean and CourseBean. The relationship between them is one to many which means that one StudentBean can have many CourseBean. Also I create a client to test the relationship.But when I call function getCourses,error occurses.The Error message is:
java.lang.reflect.UndeclaredThrowableException
at $Proxy2.getCourses(Unknown Source)
at first.client.Test.main(Test.java:75)
Caused by: java.io.NotSerializableException: org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
at java.rmi.MarshalledObject.(MarshalledObject.java:92)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:363)
at sun.reflect.GeneratedMethodAccessor68.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:87)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:97)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
... 2 more
It seems that Collection is not Serializable .
I define the getCourses like the following:
/**
*
* @ejb.interface-method view-type = "both"
*
* @ejb.relation
* name = "StudentCourse"
* role-name = "Student-Select-Many-Courses"
* target-ejb = "CourseEJB"
* target-role-name = "Many-Course-Selected-By-One-Student"
* target-multiple = "no"
* target-cascade-delete = "no"
*
*/
public abstract java.util.Collection getCourses();
/**
* @ejb.interface-method view-type = "both"
*
*/
public abstract void setCourses(java.util.Collection courses);
CAN SOME ONE FIGURE THE PROBLEM ?
THANKS