Geniedesalpages
Geniedesalpages

Reputation: 418

Eclipse RCP, RMI and Bundles

I'm trying to combine Eclipse RCP with RMI. For that purpose I created six bundles: (In parenthesis are dependencies)

Now I started the serverapp, but I got a

Caused by: java.lang.ClassNotFoundException: core.rmi.CallbackServerInterface (no security manager: RMI class loader disabled)

Now I started the server with

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

(My java.policy file is in the core plugin). I thought the problem was the classpath. So I made core and server buddies:

Eclipse-BuddyPolicy: registered

in the core bundle manifest file and

Eclipse-RegisterBuddy: core

In the server bundle manifest file. Which didn't help, since I got the exact same error.

Does anyone know where I could have gone wrong on this one?

Upvotes: 1

Views: 1107

Answers (1)

Geniedesalpages
Geniedesalpages

Reputation: 418

So apparently the problem was, that OSGI uses its own Classloader. So before we do the Naming bind we need:

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

After this, the server works like a charm, and the client can connect.

Upvotes: 1

Related Questions