[OSGi] Multibindings and AssistedInject JARs need version property for fragment host
envgap__google__guice-1049
01 / FAILURE SIGNATURE
As reported upstream
java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) previously initiated loading for a different type with name "com/google/inject/Binder"
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
e68fab652406b0d85bf294afe8cb9930ac9e6d42- Manifest
extensions/pom.xml- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
google/guice #1049 · read the original issue
The libraries "guice-multibindings" and "guice-assistedinject" are implemented as OSGi fragements for the "com.google.inject" bundle. If two versions (e.g. 3.0.0 and 4.0.0) of Guice are used within the same OSGi container (Eclipse Equinox) then the following exception occurs: > java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) previously initiated loading for a different type with name "com/google/inject/Binder" > at java.lang.ClassLoader.defineClass1(Native Method) > at java.lang.ClassLoader.defineClass(Unknown Source) > at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(ModuleClassLoader.java:273) > at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass(ClasspathManager.java:632) > at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(ClasspathManager.java:586) > at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:538) > at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:525) > at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:325) > at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:334) > at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:411) > at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:361) > at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:353) > at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161) > at java.lang.ClassLoader.loadClass(Unknown Source) > at com.google.inject.multibindings.Multibinder.newRealSetBinder(Multibinder.java:176) > at com.google.inject.multibindings.Multibinder.newSetBinder(Multibinder.java:132) I think this is due to the following line within the MANIFEST.MF of each bundle: > Fragment-Host: com.google.inject The Fragment-Host should not only specify the host bundle but also its version: > Fragment-Host: com.google.inject;bundle-version=4.0.0
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]