Hi

I'm having a problem making an RMI call using Spring DM when I pass my
domain objects as method arguments. RMI calls work fine when I call
methods that don't take arguments, or ones that take Java types as
arguments. However when I pass my own domain objects as arguments, I
get the error shown at the end of this post. It appears to be a
classloading issue where the Spring classes can't find my domain
classes. My domain objects are stored in a single bundle with the
necessary packages exported in the manifest. All my bundles are
running in the same OSGi container.

As a test I added DynamicImport-Package: * to the manifests of the
Spring jars shipped with Spring DM (spring-beans, spring-context,
spring-core etc.), and this resolved the problem. I tested this with
both the 2.5.5 and 2.5.6.A versions of the jars, with the same results
in both cases.

I also tested with version 2.5.6 of spring.jar, and the tests failed
unless I added DynamicImport-Package: * to its' manifest. When I ran
my tests using the org.springframework.bundle.spring_2.5.6 bundle that
ships with Spring IDE, they worked. The manifest of that bundle
already has a DynamicImport-Package: * entry. Do the spring-beans,
spring-core jars etc need this line to be added too? (Or at least some
fix to be made, as I know dynamic imports are not OSGi best practice).

I know the stack trace below indicates I've no security manager
enabled, but this is not the source of the issue. The server is
attempting to download the class because it can't find it, but it
should be able to find it as it is exported by my domain bundle.

Has anyone come across this issue before? Is this a Spring issue, a
core OSGi issue, or is it an error on my behalf? In general there
seems to be very little on the web about OSGi + RMI, has anyone used
it and if so have you had any problems?

Thanks in advance for your help.

David

org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'rmiTestClient' defined in URL [bundleentry://16/META-INF/spring/bundle-c
ontext.xml]: Error setting property values; nested exception is org.springframew
ork.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:50042/rmiTestServiceRmi]; nested exception is java.rmi.ServerException: Remo
teException occurred in server thread; nested exception is:
        java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
        [B]java.lang.ClassNotFoundException:
rmitest.common.RmiTestBean [/B](no securit
y manager: RMI class loader disabled)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1279)
        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:222)
        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:728)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp
plicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.ja
va:288)
        at org.springframework.osgi.extender.internal.dependencies.startup.Depen
dencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterAp
plicationContextExecutor.java:145)
        at java.lang.Thread.run(Unknown Source)
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to