Skip to main content



      Home
Home » Eclipse Projects » Equinox » RMIClassLoader can't find my class.
RMIClassLoader can't find my class. [message #101737] Tue, 20 November 2007 11:36 Go to next message
Eclipse UserFriend
Hello,

I have another problem with RMI:

Configuration:

Server :
BundleA : a classe named "A" (serializable). The package containing
this class is not exported.
BundleX : contains a class which has to manage the communication with
the client. This bundle doesn't know A.

Client :
BundleA : the same bundle as the server
BundleY : contains a callback class. These callbacks will be called by
the server. This bundle doesn't know A.
BundleZ : handle the instance of A sent by the Server.

Code in BundleX :

// BundleX handle instanceA like a java "Object" Object.
// it wants to send it to the client.
getClient().callback((Object)instanceA)

Code in BundleY :

void callback(Object o) {
// in fact o is an A
myBundleZObject.handleObject(o);
}

At the execution I have this type of error :

java.rmi.ServerException: RemoteException occurred in server thread;
nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested
exception is:
java.lang.ClassNotFoundException: bundleA.A
....

I thinks RMIClassLoader is trying to load A on the client side. But it
don't succeed.

But if I export the package containing A and that I import it on my
BundleX and my BundleY it works.

I would like to keep the independency between my bundle. The X and Y
bundle don't want to know what is the type of the object they handle.
They just want to pass them to other bundle (here bundleZ) which will be
able to Handle them in function of their real type.

If anyone has encountered this problem, I will be pleased to hear his
solution.

Thanks.

Mickaël.
Re: RMIClassLoader can't find my class. [message #101788 is a reply to message #101737] Wed, 21 November 2007 06:19 Go to previous message
Eclipse UserFriend
I found the solution:

BundleA manifest:
Export-Package: bundleA.A; type="myType"

BundleX & BundleY manifest:
DynamicImport-Package: *; type="myType"

This implies that the bundle class loader of BundleX & BundleY will load
all the package with the type : "myType".


Mickael Gauvin a écrit :
> Hello,
>
> I have another problem with RMI:
>
> Configuration:
>
> Server :
> BundleA : a classe named "A" (serializable). The package containing
> this class is not exported.
> BundleX : contains a class which has to manage the communication with
> the client. This bundle doesn't know A.
>
> Client :
> BundleA : the same bundle as the server
> BundleY : contains a callback class. These callbacks will be called by
> the server. This bundle doesn't know A.
> BundleZ : handle the instance of A sent by the Server.
>
> Code in BundleX :
>
> // BundleX handle instanceA like a java "Object" Object.
> // it wants to send it to the client.
> getClient().callback((Object)instanceA)
>
> Code in BundleY :
>
> void callback(Object o) {
> // in fact o is an A
> myBundleZObject.handleObject(o);
> }
>
> At the execution I have this type of error :
>
> java.rmi.ServerException: RemoteException occurred in server thread;
> nested exception is:
> java.rmi.UnmarshalException: error unmarshalling arguments; nested
> exception is:
> java.lang.ClassNotFoundException: bundleA.A
> ...
>
> I thinks RMIClassLoader is trying to load A on the client side. But it
> don't succeed.
>
> But if I export the package containing A and that I import it on my
> BundleX and my BundleY it works.
>
> I would like to keep the independency between my bundle. The X and Y
> bundle don't want to know what is the type of the object they handle.
> They just want to pass them to other bundle (here bundleZ) which will be
> able to Handle them in function of their real type.
>
> If anyone has encountered this problem, I will be pleased to hear his
> solution.
>
> Thanks.
>
> Mickaël.
Previous Topic:OSGi console on RCP/Exclipse application.
Next Topic:Re: Plugin.getBundle() == null!
Goto Forum:
  


Current Time: Fri May 09 12:07:52 EDT 2025

Powered by FUDForum. Page generated in 0.14069 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top