[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.ecf] Re: Linkage error with R-OSGI

Alain,

After looking around a little bit, it seems that others have experienced similar LinkageErrors when they have two versions of a single interface class (i.e. IAddress) within the same runtime (i.e. perhaps in two other bundles?). Is it possible that two versions of IAddress class exist in your runtime and that this is causing a similar problem?

Scott


Alain Picard wrote:
We are trying to implement a remote DAO infrastructure to move all db related calls to the server and we are having some issues.

After making some progress we are now getting the following error:
java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) previously initiated loading for a different type with name "com/castortech/iris/core/db/modelobjects/IAddress"


What we have as a service is:
public interface IAddressDAO extends GenericDAO<IAddress, Integer> {
    IAddress build();
}

here is the call:
final IAddressDAO proxy = (IAddressDAO)service.getProxy();
final IAddress address = proxy.build();

and the error occurs on the client side at the end of the remote call to build(). We can see that call returns an instance of Address (which implements IAddress) and that now goes through correctly (had many issues earlier with class not found here).

But it appears that when it tries to cast back to an IAdress here in the proxy:
public IAddress build() {
return (IAddress)this.endpoint.invokeMethod("r-osgi://127.0.0.1:9278#131", "build()Lcom/castortech/iris/core/db/modelobjects/IAddress;", new Object[0]));
}


that is gives the error.

BTW, I have modified the code a bit and I am saving the jar that is produced, and other than the proxy, it contains IAddress and its 2 superinterfaces as well as the IAddressDAO and its superinterface & the eclipse IAdaptable.

My research has been pretty unsuccessful at getting anywhere with this, other than this could be related to tales of class loaders (where I am very clueless and I've lost countless hours in the past). Otherwise, the only other clue is that this could be related to the jar instrumentation when dealing with interfaces.

So, I am deferring to the experts. Please help.

Thanks
Alain