-
Sep 1st, 2008, 12:13 AM
#1
Race Issue with RMIServiceExporter when used in more than one bundle
Hi
I'm trying to export RMI services (using the same, Spring created, RMI-registry) from different bundles. During application context creation I am running into a race condition, because both bundles try to create the RMI registry and bind it to the same port (happens in RmiServiceExporter.getRegistry() and is pretty good reproducable). I've tried to solve the problem by extending RmiServiceExporter and synchronizing the getRegistry methods with RmiServiceExporter.class, e.g.
{{{
protected Registry getRegistry(...) {
synchronized(SynchronizedRmiServiceExporter.class) {
return super.getRegistry(...);
}
}
}}}
Although this solves the basic issue, I now experience problems because (known) objects passed from clients to the service (and only in this direction!) cannot be deserialized any more (ClassNotFoundException). I suppose that Spring somehow uses the class loader associated with the RmiServiceExporter instance used ?
I can solve the issue by using a dedicated RMI service registry which I start manually, however, if there is a chance to get things running with letting Spring manage this I'd be happy :o)
Thanks in advance!
Peter
-
Sep 1st, 2008, 12:49 AM
#2
Please use [ code][/code ] tags when posting code, makes it a bit more readable
.
I would deploy a third bundle which is your RMI Registry and then let the other 2 bundles use that registry. That way Spring is still in control, you only need to create a seperate bundle for you registry.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules