Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] Help debug classloader conflict loading plugin in standalone instance (not in launch config instance)?

I'm working on an eclipse plugin codebase that uses Tycho to build itself. The application requires several artifacts that aren't available in a p2 repo. To resolve this, I created one plugin project whose only purpose is to use the "copy-dependencies" goal from the "maven-dependency-plugin" to specify the artifacts that are needed and make them available in the "Bundle-ClassPath" property of the same plugin. I then set other plugins that require these libraries to depend on this plugin.

This had been working fine, although there was one point where I saw the following error after installing the plugin from a local update site constructed from the build:

    java.lang.LinkageError: org/antlr/v4/runtime/TokenStream

After some fiddling, this went away, although I wasn't certain exactly what I did to make it go away.

I'm aware of the fact that this indicates a conflict with loading a class from multiple classloaders.

Today, this error came back.

Curiously, if I instead test this with an "Eclipse Application" run configuration, loading all plugins in the workspace, I don't see the error.

I changed the command line of the Eclipse instance (not the one from the launch configuration) to add "-verbose:class" to see where this is loaded from. I extracted the following relevant lines from the output:
[Loaded org.antlr.v4.runtime.TokenStream from file:/home/opnfv/frameworks/eclipse-neon/java-mars/eclipse/../../../../.p2/pool/plugins/net.sf.eclipsecs.checkstyle_6.16.0.201603042321/checkstyle-6.16.1-all.jar] [Loaded org.antlr.v4.runtime.TokenStream from file:/home/opnfv/frameworks/eclipse-neon/java-mars/eclipse/configuration/org.eclipse.osgi/605/0/.cp/libs/antlr4-runtime-4.5.1.jar] java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) previously initiated loading for a different type with name "org/antlr/v4/runtime/TokenStream"
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(
at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass([Loaded$FilteredCollection from file:/home/opnfv/frameworks/eclipse-neon/java-mars/eclipse/../../../../.p2/pool/plugins/]

at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass( at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl( at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl( at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass( at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass( at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass( at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal( at org.eclipse.osgi.internal.loader.BundleLoader.findClass( at org.eclipse.osgi.internal.loader.BundleLoader.findClass( at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    at org.antlr.v4.runtime.Parser.setInputStream(

I could use some ideas or suggestions for troubleshooting and fixing this.

Back to the top