Re: Spring RMI exported bean cant find enum defined in local jar
Gregg Wonderly <[email protected]> Tue, 19 May 2009 20:14:58 -0500
| Newsgroups | gmane.comp.java.sun.rmi |
|---|---|
| Message-ID | <[email protected]> |
Check to make sure that any threads you are creating are actually setting the context class loader correctly. What I usually do, in any class that I know will be downloaded and which has code executed by either the AWT event thread, or another thread which I create, is to do Thread .currentThread().setContextClassLoader( getClass().getClassLoader() ); at the entry to Runnable.run() or whatever the entry point is to make sure that the context loader includes the loader of the current class. Gregg Wonderly On May 13, 2009, at 6:46 AM, oli85 wrote: > Hi, I have some experienced some ClassNotFoundException when RMI > exporting: > > I have an enum type Status defined in TradingDestination class(like > TradingDestination$Status) which comes in a local jar file. Status is > referenced in MarketManagementService class which is a spring bean > exported > using RMI. The exception thrown are as follows: > > org.springframework.remoting.RemoteAccessException: Could not access > remote > service [rmi://lrpu13.uk.db.com:19101/MarketManagementService]; nested > exception is java.rmi.ServerException: RemoteException occurred in > server > thread; nested exception is: > java.rmi.UnmarshalException: error unmarshalling arguments; > nested > exception is: > java.lang.ClassNotFoundException: > com.db.efx.dna.domain.TradingDestination$Status (no security > manager: RMI > class loader disabled) > at > org > .springframework > .remoting > .rmi > .RmiClientInterceptorUtils > .convertRmiAccessException(RmiClientInterceptorUtils.java:181) > at > org > .springframework > .remoting > .rmi.RmiClientInterceptor.doInvoke(RmiClientInterceptor.java:342) > at > org > .springframework > .remoting.rmi.RmiClientInterceptor.invoke(RmiClientInterceptor.java: > 258) > at > org > .springframework > .aop > .framework > .ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java: > 171) > at > org > .springframework > .aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) > at $Proxy1.setOutletEnbledStatus(Unknown Source) > at > com > .db > .efx > .testharness > .dna > .market > .MarketOptionActionAdapter > .handleEnableOutletOption(MarketOptionActionAdapter.java:73) > at > com > .db > .efx > .testharness > .dna > .market > .MarketOptionActionAdapter > .executeAction(MarketOptionActionAdapter.java:24) > at > com > .db > .efx > .testharness > .dna > .market > .MarketOptionActionAdapter > .executeAction(MarketOptionActionAdapter.java:11) > at > com.db.efx.testharness.adapter.ActionAdapter.run(ActionAdapter.java: > 64) > at java.lang.Thread.run(Thread.java:619) > Caused by: java.rmi.ServerException: RemoteException occurred in > server > thread; nested exception is: > java.rmi.UnmarshalException: error unmarshalling arguments; > nested > exception is: > java.lang.ClassNotFoundException: > com.db.efx.dna.domain.TradingDestination$Status (no security > manager: RMI > class loader disabled) > at > sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:336) > at sun.rmi.transport.Transport$1.run(Transport.java:159) > at java.security.AccessController.doPrivileged(Native Method) > at sun.rmi.transport.Transport.serviceCall(Transport.java:155) > at > sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java: > 535) > at > sun.rmi.transport.tcp.TCPTransport > $ConnectionHandler.run0(TCPTransport.java:790) > at > sun.rmi.transport.tcp.TCPTransport > $ConnectionHandler.run(TCPTransport.java:649) > at > java.util.concurrent.ThreadPoolExecutor > $Worker.runTask(ThreadPoolExecutor.java:885) > at > java.util.concurrent.ThreadPoolExecutor > $Worker.run(ThreadPoolExecutor.java:907) > at java.lang.Thread.run(Thread.java:619) > at > sun > .rmi > .transport > .StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java: > 255) > at > sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java: > 233) > at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142) > at > org > .springframework.remoting.rmi.RmiInvocationWrapper_Stub.invoke(Unknown > Source) > at > org > .springframework > .remoting > .rmi.RmiClientInterceptor.doInvoke(RmiClientInterceptor.java:393) > at > org > .springframework > .remoting > .rmi.RmiClientInterceptor.doInvoke(RmiClientInterceptor.java:339) > ... 9 more > Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; > nested exception is: > java.lang.ClassNotFoundException: > com.db.efx.dna.domain.TradingDestination$Status (no security > manager: RMI > class loader disabled) > at > sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:296) > at sun.rmi.transport.Transport$1.run(Transport.java:159) > at java.security.AccessController.doPrivileged(Native Method) > at sun.rmi.transport.Transport.serviceCall(Transport.java:155) > at > sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java: > 535) > at > sun.rmi.transport.tcp.TCPTransport > $ConnectionHandler.run0(TCPTransport.java:790) > at > sun.rmi.transport.tcp.TCPTransport > $ConnectionHandler.run(TCPTransport.java:649) > at > java.util.concurrent.ThreadPoolExecutor > $Worker.runTask(ThreadPoolExecutor.java:885) > at > java.util.concurrent.ThreadPoolExecutor > $Worker.run(ThreadPoolExecutor.java:907) > ... 1 more > Caused by: java.lang.ClassNotFoundException: > com.db.efx.dna.domain.TradingDestination$Status (no security > manager: RMI > class loader disabled) > at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java: > 375) > at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java: > 165) > at > java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620) > at > java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247) > at > sun > .rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java: > 197) > at > java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java: > 1575) > at > java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) > at java.io.ObjectInputStream.readEnum(ObjectInputStream.java: > 1686) > at > java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1326) > at java.io.ObjectInputStream.readArray(ObjectInputStream.java: > 1667) > at > java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323) > at > java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java: > 1947) > at > java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871) > at > java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java: > 1753) > at > java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) > at > java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) > at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java: > 306) > at > sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:290) > ... 9 more > > I have double checked the classpath to make sure the jar file is > indeed > included. So could anyone help me with this issue please? Thanks in > advance! > -- > View this message in context: http://www.nabble.com/Spring-RMI-exported-bean-cant-find-enum-defined-in-local-jar-tp23520225p23520225.html > Sent from the Java - RMI mailing list archive at Nabble.com. > > = > = > = > = > = > ====================================================================== > To unsubscribe, send email to [email protected] and include in > the body > of the message "signoff RMI-USERS". For general help, send email to > [email protected] and include in the body of the message "help". > > For a list of frequently asked RMI questions please refer to: > http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html > > To view past RMI-USERS postings, please see: > http://archives.java.sun.com/archives/rmi-users.html =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff RMI-USERS". For general help, send email to [email protected] and include in the body of the message "help". For a list of frequently asked RMI questions please refer to: http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html To view past RMI-USERS postings, please see: http://archives.java.sun.com/archives/rmi-users.html