[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [equinox-dev] How to start a RMI service in a bundle of Equinox
|
On Monday 11 December 2006 16:53, 姜健 wrote:
> I want to migrate my old RMI service into equinox,but I don't know how can
> I attach -Djava.security.policy=myplicy.properties into the bundle. Now I
> attach it to the VM arguments of my Equinox OSGi framework Run item.
I think that Equinox supports you to specify policies in its start
configuration.
> But when running,an exception throws like this:
> Caused by: java.lang.ClassNotFoundException:
> org.shuyaji.workflow.api.client.rmi.RMIEngineImpl_Stub at
> java.net.URLClassLoader$1.run(URLClassLoader.java:199)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
First of all I am a bit surprised to see that the RegistryImpl (jdk classes)
is compiled with JDK1.1 styled _skel support and it being used.
The problem occurs on your server side, which I presume is running on OSGi. If
not, then the problem is elsewhere.
You have not told us how you start the Registry.
What is important is that the rebind() method will serialize the Remote
Reference to the RMI service, and send it to the RegistryImpl. Which in turn
will hand it out to whomever is asking. The RegistryImpl is a nothing
special, and just another RMI service with a known UnicastRef. Now, when the
reference to your service is being serialized, it also transfers the codebase
location used by the classes in the serialized stream, so the RegistyImpl
knows where to get them.
So, if you don't specify reachable URLs (http://, ftp:// et al) in a
URLClassLoader (not the case in OSGi, I think), then the system property
java.rmi.server.codebase will be used as the reference to the classes. You
are probably missing this, and it needs to point to the location of
the "mobile code" (term used for RMI 2.0 n.k.a JERI).
Hope that helps.
Cheers
Niclas