Hello, I'm quite new to OSGi so please correct me if I got something wrong! We have a distributed application with some server and some client bundles. Communication is done through r-OSGi. We can start the server bundle locally in which case everything works fine. When I try to access the server, though, I get 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 "de/braindrops/bs/entities/User" at java.lang.ClassLoader.defineClass1( Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass( DefaultClassLoader.java:164 ) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass( ClasspathManager.java:554 ) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl( ClasspathManager.java:524 ) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl( ClasspathManager.java:455 ) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader( ClasspathManager.java:443 ) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass( ClasspathManager.java:423 ) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass( DefaultClassLoader.java:192 ) at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass( BundleLoader.java:372 ) at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal( BundleLoader.java:448 ) at org.eclipse.osgi.internal.loader.BundleLoader.findClass( BundleLoader.java:401 ) at org.eclipse.osgi.internal.loader.BundleLoader.findClass( BundleLoader.java:389 ) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass( DefaultClassLoader.java:86 ) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at proxy.bjcobgioaoch_jchidj.de.braindrops.bs.services.IUserManagementImpl.getUserForToken(Unknown Source) at de.braindrops.bs.client.serviceadapter.model.ClientModel.<init>( ClientModel.java:82 ) ... The signature of the called remote method is: public de.braindrops.bs.entities.User getUserForToken(String token); The User class is a Serializable. Calling methods that return void or runtime types does not cause this problem. Googling for this error was mostly unsatisfactory. As a matter of fact there is no other class "de/braindrops/bs/entities/User" in another jar file or bundle. My assumption is that two different class loaders, one from the "proxy..." bundle, try to load the class definition. If this assumption should be correct, I still don't understand a) why this happens, b) why this is a problem, and c) how this can be avoided. After all, we have multiple client bundles exchanging User objects; if each of these use their own class loader and no problem occurs why should it happen with the proxy bundle. The proxy bundle is generated by r-OSGi at runtime; maybe this is a problem with the "type injection", but I don't understand fully how this works. Unfortunately I know of no way to inspect this bundle's content at runtime over the OSGi console or any other means. Please help me with this issue as I am quite at the end of my wits here. Maybe this is an r-OSGi-specific problem and I'm on the wrong mailing list. If so, please let me know. Thanks and kind regards, Leo
_______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev