0

Bundles

So I'm using RMI in an Eclipse RCP application. The classloader of RMI and OSGI hate each other so much, but I could solve my first problem here.

My server application consists of the Server bundle, which depends on Core. Additionally the bundle Map is loaded, using an extension point of core (DataUpdate).

Similarly the Client is started depending on Core and loading Map as a plugin.

Now sending a User from the client to the Server poses no problem anymore (solved issue above). Sadly the reverse doesn't work. The Client is stored as Callback on the Server and should receive DataUpdate objects. Those are created in the Map bundle on the server and sent via RMI. When I receive them on the client side I get the ominous ClassNotFound exception. I do the same as on the server:

Thread.currentThread().setContextClassLoader(
                this.getClass().getClassLoader());

But this doesn't help. Also to start both server and client my start parameters are:

-consoleLog -Djava.security.policy=java.policy -Djava.rmi.server.codebase=file:${workspace_loc}

And in the client I set the security manager to a personal implementation which allows everything.

So does anyone have an idea, why the class is not found?

Community
  • 1
  • 1
Geniedesalpages
  • 418
  • 1
  • 3
  • 15

1 Answers1

0

So the cynic answer to this is not to use the Sun RMI implementation.

I now use Kryonet for which I can set the classes of the objects being sent over the Network. Since each of these classes knows its classloader the problem is solved.

Geniedesalpages
  • 418
  • 1
  • 3
  • 15