Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
Spring DM and RmiProxyFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring DM and RmiProxyFactoryBean

    Hi there,

    I have a Bundle A which uses a Service defined by a Spring-Bean using a RmiProxyFactoryBean. The Service runs on a remote server. I have a Bundle B which contains business object, which are being used by Bundle A (Import-Package) and the remote Service.

    When Bundle A calls the remote Service, the remote method is being called and the Service returns the business object. However, when it's being unmarshalled, I get the following Exception:

    Code:
    java.rmi.UnmarshalException: error unmarshalling return; nested exception is: 
    	java.lang.ClassNotFoundException: Vertrieb (no security manager: RMI class loader disabled)
    	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:178)
    	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)
    	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 $Proxy7.readAll(Unknown Source)
    	at 
    ....
    
    Caused by: java.lang.ClassNotFoundException: Vertrieb (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.readOrdinaryObject(ObjectInputStream.java:1732)
    	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    	at java.util.ArrayList.readObject(ArrayList.java:593)
    	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:597)
    	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
    	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1846)
    	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.UnicastRef.invoke(UnicastRef.java:155)
    	... 96 more
    Now I introduced another Bundle B, which wraps a Proxy around the remote Service and simply delegates all calls to the Service. I exposed the interface of Bundle B using osgi:service. Bundle A simply references this service using osgi:reference. Now Bundle A calls Bundle B, which then calls the remote Service and the funny thing is, it works. No Exception!

    Any ideas or comments? I suppose it's a classloader issues....
    Last edited by dlinsin; Jun 4th, 2008, 01:51 AM.

  • #2
    The error indicates the there is no security used and thus the RMI class loader fails. Adding a proxy still depends on RMI which means the same behaviour should apply - however, probably since things are done locally to the RMI bundle, you don't have to expose the internals so much but just a simple interface signature which is already loaded and known to both A and B (and which doesn't require any RMI loading).

    Comment

    Working...
    X