Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » JDT throws ClassNotFoundException while instantiating ExecutableExtensionFactory
JDT throws ClassNotFoundException while instantiating ExecutableExtensionFactory [message #1719173] Tue, 05 January 2016 19:48 Go to next message
Erick Hagstrom is currently offline Erick HagstromFriend
Messages: 108
Registered: April 2014
Location: USA
Senior Member
My application includes both an XText DSL and the JDT (the Java editor, among other things). When run from Eclipse all is well, but when I run from an exported executable, the following happens:

When I open a Java editor on a Java source file, org.eclipse.jdt.core throws org.eclipse.core.runtime.CoreException: Plug-in org.eclipse.xtext.ui.shared was unable to load class org.eclipse.xtext.ui.shared.internal.ExecutableExtensionFactory.

This is caused by java.lang.NoClassDefFoundError: org/eclipse/xtext/ui/guice/AbstractGuiceAwareExecutableExtensionFactory.

And this is caused by java.lang.ClassNotFoundException: org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory cannot be found by org.eclipse.xtext.ui.shared_2.9.1.v201512180746.

I believe this to be related to org.eclipse.xtext.ui.shared declaring an extension to org.eclipse.jdt.core.compilationParticipant as class org.eclipse.xtext.ui.shared.internal.ExecutableExtensionFactory:org.eclipse.xtext.builder.smap.DebugSourceInstallingCompilationParticipant. JDT tries to instantiate ExecutableExtensionFactory but can't find AbstractGuiceAwareExecutableExtensionFactory.

Is this a problem in the way I've exported my application? Am I holding something wrong?

The full trace is as follows:

!ENTRY org.eclipse.jdt.core 4 2 2016-01-05 14:38:00.107
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jdt.core".
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in org.eclipse.xtext.ui.shared was unable to load class org.eclipse.xtext.ui.shared.internal.ExecutableExtensionFactory.
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.j
ava:178)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
at org.eclipse.jdt.internal.core.JavaModelManager$CompilationParticipants$1.run(JavaModelManager.java:344)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.jdt.internal.core.JavaModelManager$CompilationParticipants.getCompilationParticipants(JavaModelManager.java:339)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.notifyParticipants(ReconcileWorkingCopyOperation.java:239)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:95)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:729)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:789)
at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1250)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:126)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:108)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:89)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:87)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.initialReconcile(JavaReconcilingStrategy.java:178)
at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.initialReconcile(CompositeReconcilingStrategy.java:114)
at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.initialReconcile(JavaCompositeReconcilingStrategy.java:136)
at org.eclipse.jface.text.reconciler.MonoReconciler.initialProcess(MonoReconciler.java:105)
at org.eclipse.jdt.internal.ui.text.JavaReconciler.initialProcess(JavaReconciler.java:406)
at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:173)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/xtext/ui/guice/AbstractGuiceAwareExecutableExtensionFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(ModuleClassLoader.java:272)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass(ClasspathManager.java:632)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(ClasspathManager.java:588)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:540)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:527)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:324)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:327)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:402)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:573)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
... 22 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory can
not be found by org.eclipse.xtext.ui.shared_2.9.1.v201512180746
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:439)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 38 more
Re: JDT throws ClassNotFoundException while instantiating ExecutableExtensionFactory [message #1719204 is a reply to message #1719173] Wed, 06 January 2016 08:17 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
The missing class is contained in 'org.eclipse.xtext.ui'.
Could check whether that bundle can be resolved and started?
Re: JDT throws ClassNotFoundException while instantiating ExecutableExtensionFactory [message #1720133 is a reply to message #1719204] Thu, 14 January 2016 15:54 Go to previous messageGo to next message
Erick Hagstrom is currently offline Erick HagstromFriend
Messages: 108
Registered: April 2014
Location: USA
Senior Member
Hi Sven, thanks for the quick reply. It would be nice if the problem were that simple, but such is not the case. I am able to load AbstractGuiceAwareExecutableExtensionFactory (and get the related Class<AbstractGuiceAwareExecutableExtensionFactory> object) prior to the point where the exception is thrown, and I still get the exception.

As a workaround, I rebuilt org.eclipse.xtext.ui.shared with a new manifest.mf file in which I changed all dependencies to org.eclipse.xtext.* bundles from optional to required. That solved my immediate problem. I understand that it's not a solution globally.

I'm still digging through it, trying to isolate the set of conditions under which this fails. I suspect, though, that ultimately it's a bug in equinox, not Xtext.
Re: JDT throws ClassNotFoundException while instantiating ExecutableExtensionFactory [message #1720160 is a reply to message #1720133] Thu, 14 January 2016 20:02 Go to previous messageGo to next message
Erick Hagstrom is currently offline Erick HagstromFriend
Messages: 108
Registered: April 2014
Location: USA
Senior Member
Got it, but it doesn't make sense to me.

We wanted our own FooExecutableExtensionFactory class, so one of us created a BetterFooExecutableExtensionFactory extends AbstractGuiceAwareExecutableExtensionFactory. I changed it so that BetterFooExecutableExtensionFactory extends (the generated) FooExecutableExtensionFactory, and the problem disappeared.

The generated FooExecutableExtensionFactory just extends AbstractGuiceAwareExecutableExtensionFactory itself, and nothing accesses it directly (that I can find using the References menu option), so I am at a loss as to why this matters, but it seems to.

How could any of this have any bearing on whether an entirely different plug-in, org.eclipse.xtext.ui.shared, would have trouble instantiating its own ExecutableExtensionFactory? *shrug*
Re: JDT throws ClassNotFoundException while instantiating ExecutableExtensionFactory [message #1720177 is a reply to message #1720160] Thu, 14 January 2016 22:11 Go to previous message
Erick Hagstrom is currently offline Erick HagstromFriend
Messages: 108
Registered: April 2014
Location: USA
Senior Member
Theory: it's a race condition.

Scenario A: My plug-in activates before org.eclipse.jdt.core. My Activator needs SharedStatusModule from org.eclipse.xtext.ui.shared and loads it. There's no need to access org.eclipse.xtext.ui from .shared, so that optional dependency is dropped/ignored. Later, org.eclipse.jdt.core activates and creates CompilationParticipants. It finds org.eclipse.xtext.ui.shared, tries to make a ExecutableExtensionFactory, finds no BundleWire (or whatever it should be at that point) representing org.eclipse.xtext.ui so never looks there, eventually finds no AbstractGuiceAwareExecutableExtensionFactory, and fails. That's my original scenario.

Scenario B: org.eclipse.jdt.core activates before my plug-in and starts instantiating CompilationParticipants. It tries to create org.eclipse.xtext.ui.shared.internal.ExecutableExtensionFactory, recognizes that the dependency on org.ecliplse.xtext.ui is necessary, so it looks there, finds AbstractGuiceAwareExecutableExtensionFactory, and successfully creates everything. Later, my plug-in activates, looks for SharedStateModule, finds it, and they all execute happily ever after.

The only thing that happened when I added an additional type between my Factory and the AbstractGuiceAware one was to make my activation take just a beat longer, giving org.eclipse.jdt.core a chance to get to org.eclipse.xtext.ui.shared before I did. Or, if there's no multi-threading in there, it did nothing and I'm going to have intermittent problems with this depending on solar flares, phases of the moon, and whether a butterfly in Munich sneezes once or twice.

So, again, probably not your bug/issue. But does it sound plausible, if not necessarily reproducible? Where do I file it? (Bugzilla, yeah, but which product etc.?)

Thanks!
Previous Topic:XText 2.9 and multiple grammars
Next Topic:Regarding Configuring Content assist in XText UI
Goto Forum:
  


Current Time: Thu Dec 02 21:27:14 GMT 2021

Powered by FUDForum. Page generated in 0.02206 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top