开发环境:jdk1.5.0_10+MyEclipse 5.0GA+jboss-4.0.5.GA+MySQL Server 5.0
工程文件:
http://www.blogjava.net/Files/qixiangnj/workspace.part1.rar
http://www.blogjava.net/Files/qixiangnj/workspace.part2.rar
http://www.blogjava.net/Files/qixiangnj/workspace.part3.rar
http://www.blogjava.net/Files/qixiangnj/workspace.part4.rar
数据库文件包含其中。
其中College和Department是一对多关系。
CollegeBean中,EJB-QL为:
SELECT OBJECT(c) FROM College c, IN (c.departments) d
* WHERE c.college_name = ? 1
希望查出某大学有多少系科。
在客户端调用时
College college = collegeHome.findDepartmentsOfCollege("C.I.T");
college.getDepartments();
报错如下:
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at $Proxy2.getDepartments(Unknown Source)
at com.cleversoft.roster.client.CollegeClient.printResults(CollegeClient.java:65)
at com.cleversoft.roster.client.CollegeClient.main(CollegeClient.java:33)
Caused by: java.io.NotSerializableException: org.jboss.ejb.plugins.cmp.jdbc.bridge.RelationSet
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at java.rmi.MarshalledObject.<init>(MarshalledObject.java:92)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:424)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
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:126)
at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:133)
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:365)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:197)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
3 more
不知何故。
望有经验者点拨,谢谢!