Results 1 to 2 of 2

Thread: Spring DM and RmiProxyFactoryBean

  1. #1
    Join Date
    Oct 2006
    Location
    Karlsruhe, Germany
    Posts
    4

    Question 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 at 12:51 AM.
    with kind regards,

    David Linsin
    - - - - - - - - - - - - - - - - - - - - - - - -
    email: dlinsin@gmail.com
    blog: http://dlinsin.blogspot.com

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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).
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •