Hi

I'm having problems in getting RMI and OSGi working together. I'm using Spring 
DM on both client and server to expose my methods over RMI etc. 

In my client OSGi framework I have Bundles A and B installed. In the server 
OSGi framework, I also have B installed, plus Bundle C. C contains the 
implementation of an interface defined in B. Bundle A calls these methods. The 
methods look like:

public RmiTestBean rmiTestMethodReturn() {
        System.out.println("Rmi Test Method Return");
        return new RmiTestBean();
}

public void rmiTestMethodSimple() {
        System.out.println("Rmi Test Method Simple");
}

public void rmiTestMethodParameter(RmiTestBean rmiTestBean) {
        System.out.println("Rmi Test Method Parameter");
}

The first two work fine, but the last one fails with the following stack trace:


org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'rmiTestClient' defined in URL [bundleentry://3/META-INF/spring/bundle-co
ntext.xml]: Error setting property values; nested exception is org.springframewo
rk.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException:
Property 'rmiTestService' threw exception; nested exception is org.springframewo
rk.remoting.RemoteAccessException: Could not access remote service [rmi://localh
ost:1199/rmiTestServiceRmi]; nested exception is java.rmi.ServerException: Remot
eException occurred in server thread; nested exception is:
        java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
        java.lang.ClassNotFoundException: rmitest.common.RmiTestBean (no securit
y manager: RMI class loader disabled)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1278)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:264)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:221)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:261)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:185)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:164)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:429)
        at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:729)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp
plicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.ja
va:276)
        at org.springframework.osgi.extender.internal.dependencies.startup.Depen
dencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterAp
plicationContextExecutor.java:145)
        at java.lang.Thread.run(Unknown Source)


I'm seems that the RMI classloader can't find the RmiTestBean class. Therefore 
it tries to download it, and gets the "no security manager: RMI class loader 
disabled" error while attempting the download. However it should be able to 
find the RmiTestBean class without needing to attempt the download. Below I've 
posted an extract from 
http://groups.google.com/group/spring-osgi/browse_thread/thread/901dbd7cf4d93791/49df04dd3a46ae56?lnk=gst&q=Help+RMI+Spring+remoting+-+Spring+and+OSGi+#49df04dd3a46ae56

There is a well known issue with RMI downloading of classes with OSGi   
which is being worked on in the OSGi core platform group.  This isn't   
a Spring DM issue, rather a core OSGi issue.  The work around is that   
you're simply going to have to have all the required classes available   
to the class loader where the error happens. 

This is from February of this year, does anyone know what the latest on this 
issue is? Do you have any suggestions as to how we can get around this issue? 
We would prefer if possible not to have to put all our classes in the same 
bundle. Thanks in advance for your help. 

Regards,
Serguey

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to