Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 314978

Summary: LinkageError: Class org/antlr/runtime/CharStream violates loader constraints
Product: [Modeling] TMF Reporter: Moritz Eysholdt <moritz.eysholdt>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sven.efftinge
Version: 1.0.0Flags: sven.efftinge: helios+
Target Milestone: RC3   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Moritz Eysholdt CLA 2010-05-29 07:56:37 EDT
I'm getting this exception when running tests, e.g. 
org.eclipse.xtext.EcoreUtil2Test.testExternalFormOfEReference()
org.eclipse.xtext.mwe.ReaderTest.testLoadMatchNone()

The error only occurs when the test is run as plugin-test. Everything seems fine if the test runs as plain java junit test.

org.antlr.runtime.CharStream is on the class path three times:
/eclipse/plugins/org.antlr.runtime_3.0.0.v200803061811.jar
/de.itemis.xtext.antlr/antlr-generator-3.0.1.jar
/org.antlr/antlr-3.0.1.jar

Could this be a version incompatibility between the version of antlr we ship and the version of antlr from orbit?


org.eclipse.emf.common.util.WrappedException: org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.xtext.builder.tests (378).
org.eclipse.emf.ecore.plugin.RegistryReader$EPackageDescriptor.getEPackage(RegistryReader.java:279)
org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage(EPackageRegistryImpl.java:133)
org.eclipse.xtext.EcoreUtil2Test.testExternalFormOfEReference(EcoreUtil2Test.java:214)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:592)
junit.framework.TestCase.runTest(TestCase.java:168)
junit.framework.TestCase.runBare(TestCase.java:134)
junit.framework.TestResult$1.protect(TestResult.java:110)
junit.framework.TestResult.runProtected(TestResult.java:128)
junit.framework.TestResult.run(TestResult.java:113)
junit.framework.TestCase.run(TestCase.java:124)
junit.framework.TestSuite.runTest(TestSuite.java:232)
junit.framework.TestSuite.run(TestSuite.java:227)
junit.framework.TestSuite.runTest(TestSuite.java:232)
junit.framework.TestSuite.run(TestSuite.java:227)
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
org.eclipse.pde.internal.junit.runtime.UITestApplication$1.run(UITestApplication.java:116)
org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3574)
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3267)
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
org.eclipse.pde.internal.junit.runtime.UITestApplication.start(UITestApplication.java:47)
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:592)
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
org.eclipse.equinox.launcher.Main.run(Main.java:1407)
org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.xtext.builder.tests (378).
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:121)
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:453)
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
java.lang.ClassLoader.loadClass(ClassLoader.java:252)
org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:338)
org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:232)
org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1197)
org.eclipse.emf.ecore.plugin.RegistryReader$EPackageDescriptor.getEPackage(RegistryReader.java:272)
	... 49 more
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.xtext.builder.tests.Activator.start() of bundle org.eclipse.xtext.builder.tests.
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:284)
org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:417)
org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:265)
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:106)
	... 61 more
Caused by: com.google.inject.internal.ComputationException: com.google.inject.internal.ComputationException: java.lang.LinkageError: Class org/antlr/runtime/CharStream violates loader constraints
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:553)
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
com.google.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
com.google.inject.internal.FailableCache.get(FailableCache.java:46)
com.google.inject.ConstructorInjectorStore.get(ConstructorInjectorStore.java:52)
com.google.inject.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:57)
com.google.inject.InjectorImpl.initializeBinding(InjectorImpl.java:377)
com.google.inject.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:645)
com.google.inject.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:581)
com.google.inject.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:172)
com.google.inject.InjectorImpl.getBindingOrThrow(InjectorImpl.java:132)
com.google.inject.InjectorImpl.getInternalFactory(InjectorImpl.java:651)
com.google.inject.FactoryProxy.notify(FactoryProxy.java:48)
com.google.inject.BindingProcessor.runCreationListeners(BindingProcessor.java:230)
com.google.inject.InjectorBuilder.initializeStatically(InjectorBuilder.java:131)
com.google.inject.InjectorBuilder.build(InjectorBuilder.java:105)
com.google.inject.Guice.createInjector(Guice.java:92)
com.google.inject.Guice.createInjector(Guice.java:69)
com.google.inject.Guice.createInjector(Guice.java:59)
org.eclipse.xtext.builder.tests.Activator.start(Activator.java:38)
org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
java.security.AccessController.doPrivileged(Native Method)
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
	... 67 more
Caused by: com.google.inject.internal.ComputationException: java.lang.LinkageError: Class org/antlr/runtime/CharStream violates loader constraints
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:553)
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
com.google.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
com.google.inject.internal.FailableCache.get(FailableCache.java:46)
com.google.inject.MembersInjectorStore.get(MembersInjectorStore.java:66)
com.google.inject.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:69)
com.google.inject.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:31)
com.google.inject.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:39)
com.google.inject.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:35)
com.google.inject.internal.FailableCache$1.apply(FailableCache.java:35)
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:549)
	... 89 more
Caused by: java.lang.LinkageError: Class org/antlr/runtime/CharStream violates loader constraints
java.lang.Class.getDeclaredMethods0(Native Method)
java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
java.lang.Class.getDeclaredMethods(Class.java:1763)
com.google.inject.spi.InjectionPoint$Factory$2.getMembers(InjectionPoint.java:395)
com.google.inject.spi.InjectionPoint$Factory$2.getMembers(InjectionPoint.java:393)
com.google.inject.spi.InjectionPoint.addInjectorsForMembers(InjectionPoint.java:359)
com.google.inject.spi.InjectionPoint.addInjectionPoints(InjectionPoint.java:353)
com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:296)
com.google.inject.MembersInjectorStore.createWithListeners(MembersInjectorStore.java:78)
com.google.inject.MembersInjectorStore.access$000(MembersInjectorStore.java:35)
com.google.inject.MembersInjectorStore$1.create(MembersInjectorStore.java:43)
com.google.inject.MembersInjectorStore$1.create(MembersInjectorStore.java:40)
com.google.inject.internal.FailableCache$1.apply(FailableCache.java:35)
com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:549)
	... 99 more
Comment 1 Moritz Eysholdt CLA 2010-05-31 10:24:37 EDT
Fixed by deleting antlr-generator-3.0.1.jar from de.itemis.xtext since this is exported by org.antlr.gen and removing exports of antrl.runtime from antlr.gen.

### Eclipse Workspace Patch 1.0
#P de.itemis.xtext.antlr
Index: .classpath
===================================================================
RCS file: /cvsroot/architecturware/xtext_external/de.itemis.xtext.antlr/.classpath,v
retrieving revision 1.3
diff -u -r1.3 .classpath
--- .classpath	20 May 2010 17:47:11 -0000	1.3
+++ .classpath	31 May 2010 14:21:11 -0000
@@ -3,6 +3,5 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="lib" path="antlr-generator-3.0.1.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
#P org.antlr
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /cvsroot/architecturware/xtext_external/org.antlr/META-INF/MANIFEST.MF,v
retrieving revision 1.5
diff -u -r1.5 MANIFEST.MF
--- META-INF/MANIFEST.MF	28 Sep 2009 14:23:42 -0000	1.5
+++ META-INF/MANIFEST.MF	31 May 2010 14:21:11 -0000
@@ -24,10 +24,6 @@
  org.antlr.analysis,
  org.antlr.codegen,
  org.antlr.misc,
- org.antlr.runtime,
- org.antlr.runtime.debug,
- org.antlr.runtime.misc,
- org.antlr.runtime.tree,
  org.antlr.stringtemplate,
  org.antlr.stringtemplate.language,
  org.antlr.stringtemplate.misc,
Comment 2 Karsten Thoms CLA 2017-09-19 16:03:13 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.