Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open Java sources after updating 2021-09 to 2021-12 #1319

Closed
digulla opened this issue Dec 14, 2021 · 9 comments
Closed

Unable to open Java sources after updating 2021-09 to 2021-12 #1319

digulla opened this issue Dec 14, 2021 · 9 comments

Comments

@digulla
Copy link

digulla commented Dec 14, 2021

I've just updated 2021-09 to 2021-12 using Oomph.

After the update, I can't open the Java editor anymore:

java.lang.NoClassDefFoundError: org/codehaus/groovy/eclipse/editor/GroovyAwareFoldingStructureProvider
	at org.codehaus.groovy.eclipse.GroovyPlugin$1.getCurrentFoldingProvider(GroovyPlugin.java:182)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.createSourceViewer(JavaEditor.java:1891)
	at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(AbstractTextEditor.java:3369)

There are two problems here:

  1. I'm not aware I had the Groovy Plugin installed before. I have a second Eclipse with Groovy because the Groovy Plugin breaks 90% of p2 updates.
  2. I can't uninstall the Groovy Plugin; it's not listed in the dialog where I can uninstall features. It's only in the features tab and the plugins tab.

How do I get rid of Groovy?

How can I make sure that Groovy is never, ever installed without my consent?

As far as I can see, the plugin is complete. Why do I get NoClassDefFoundError???

@digulla
Copy link
Author

digulla commented Dec 14, 2021

Details from the about dialog:

Eclipse Groovy Development Tools

Version: 4.1.0.v202103311613-e2103-RELEASE

Copyright (c) 2009-2021 Pivotal Software, Inc. and others. All rights reserved.
Visit https://github.com/groovy/groovy-eclipse/wiki

Features:

Pivotal Software, Inc. Groovy-Eclipse 4.1.0.v202103311613-e2103-RELEASE org.codehaus.groovy25.feature
Pivotal Software, Inc. Groovy-Eclipse 4.1.0.v202103311613-e2103-RELEASE org.codehaus.groovy.eclipse.feature

Plug-ins:

Pivotal Software, Inc.	Apache Groovy	2.5.14.v202103311613-e2103-RELEASE	org.codehaus.groovy
Pivotal Software, Inc.	Groovy Ant support	4.1.0.v202103311613-e2103-RELEASE	org.codehaus.groovy.eclipse.ant
Pivotal Software, Inc.	Groovy AST Views	4.1.0.v202103311613-e2103-RELEASE	org.codehaus.groovy.eclipse.astviews
Pivotal Software, Inc.	Groovy Code Assist	4.1.0.v202103311613-e2103-RELEASE	org.codehaus.groovy.eclipse.codeassist
Pivotal Software, Inc.	Groovy Code Browsing	4.1.0.v202103311613-e2103-RELEASE	org.codehaus.groovy.eclipse.codebrowsing
Pivotal Software, Inc.	Groovy Compiler Resolver	4.1.0.v202103311613-e2103-RELEASE	org.codehaus.groovy.eclipse.compilerResolver
Pivotal Software, Inc.	Groovy Core	4.1.0.v202103311613-e2103-RELEASE	org.codehaus.groovy.eclipse.core
Pivotal Software, Inc.	Groovy DSL support	4.1.0.v202103311613-e2103-RELEASE	org.codehaus.groovy.eclipse.dsl
Pivotal Software, Inc.	Groovy-Eclipse	4.1.0.v202103311613-e2103-RELEASE	org.codehaus.groovy.eclipse
Pivotal Software, Inc.	Groovy-Eclipse integration	4.1.0.v202103311613-e2103-RELEASE	org.eclipse.jdt.groovy.core
Pivotal Software, Inc.	Groovy Quick Fix	4.1.0.v202103311613-e2103-RELEASE	org.codehaus.groovy.eclipse.quickfix
Pivotal Software, Inc.	Groovy Refactoring	4.1.0.v202103311613-e2103-RELEASE	org.codehaus.groovy.eclipse.refactoring
Pivotal Software, Inc.	Groovy UI	4.1.0.v202103311613-e2103-RELEASE	org.codehaus.groovy.eclipse.ui

@eric-milles
Copy link
Member

When you use auto-update to cross major versions of eclipse, the Groovy Development Tools JDT patch gets out of sync. You need a newer update site link for Eclipse 2021-12: https://dist.springsource.org/snapshot/GRECLIPSE/e4.22

If you wish for GDT to never be installed on a particular installation, you'll need to take that up with Eclipse Platform or Oomph teams.

@digulla
Copy link
Author

digulla commented Dec 15, 2021

I agree this is probably a bug somewhere in p2 / Oomph. I created it here because people are going to search for the error message and "Groovy".

@rolfth
Copy link

rolfth commented Dec 16, 2021

If the Groovy patch depends on specific JDT version, this should be managed on the Groovy side by specifying the expected version ranges of the JDT plugins in the manifest. When ranges are correctly specified, p2 and oomph will correctly handle this case to prevent conflicts in the installation.

@eric-milles
Copy link
Member

@rolfth
Copy link

rolfth commented Dec 16, 2021

Okey, not my full expertise, but it seems that https://github.com/groovy/groovy-eclipse/blob/master/ide/org.codehaus.groovy.eclipse.ui/src/org/codehaus/groovy/eclipse/GroovyPlugin.java gets installed even when the feature patch is no longer installed. So after an update the feature patch is no longer applied as the JDT feature is upgraded.

Somehow it must be ensured in https://github.com/groovy/groovy-eclipse/blob/master/ide/org.codehaus.groovy.eclipse.ui/META-INF/MANIFEST.MF that the groovy patch is present when this plugin is installed. Maybe by depending on the patched version of the jdt or by the enclosed feature, though I don't know if this leads to unexpected side effects and how robust this is.

@JacquesLeRoux
Copy link

JacquesLeRoux commented Jan 13, 2022

Hi @eric-milles, actually it's not enough it seems. I get this after updating using https://dist.springsource.org/snapshot/GRECLIPSE/e4.22

org.eclipse.core.runtime.CoreException: Plug-in org.codehaus.groovy.eclipse.ui was unable to load class org.codehaus.groovy.eclipse.editor.GroovyEditor.
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:212)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:198)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:920)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:246)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:63)
	at org.eclipse.ui.internal.WorkbenchPlugin.lambda$0(WorkbenchPlugin.java:287)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:285)
	at org.eclipse.ui.internal.registry.EditorDescriptor.createEditor(EditorDescriptor.java:231)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:321)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPart(CompatibilityPart.java:304)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPart(CompatibilityEditor.java:61)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:342)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:995)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:960)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:140)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:403)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:330)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:91)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:60)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:42)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:132)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:994)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:658)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:762)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:727)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:711)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.createElement(PartServiceImpl.java:1304)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1265)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:397)
	at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:283)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3162)
	at org.eclipse.ui.internal.WorkbenchPage.lambda$9(WorkbenchPage.java:3112)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3110)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3080)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3063)
	at org.eclipse.ui.internal.ReopenEditorMenu.open(ReopenEditorMenu.java:282)
	at org.eclipse.ui.internal.ReopenEditorMenu$1.lambda$0(ReopenEditorMenu.java:232)
	at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4243)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1060)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4060)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3632)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1154)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1045)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
Caused by: java.lang.ClassNotFoundException: An error occurred while automatically activating bundle org.codehaus.groovy.eclipse.ui (1545).
	at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:126)
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:570)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:335)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:384)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:475)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:403)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:616)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:196)
	... 72 more
Caused by: org.osgi.framework.BundleException: Exception in org.codehaus.groovy.eclipse.GroovyPlugin.start() of bundle org.codehaus.groovy.eclipse.ui.
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:828)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:759)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1019)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:365)
	at org.eclipse.osgi.container.Module.doStart(Module.java:605)
	at org.eclipse.osgi.container.Module.start(Module.java:468)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:404)
	at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:117)
	... 81 more
Caused by: java.lang.NoSuchMethodError: 'java.util.HashMap org.eclipse.core.internal.runtime.AdapterManager.getFactories()'
	at org.codehaus.groovy.eclipse.debug.ui.GroovyJavaDebugElementAdapterFactory.<init>(GroovyJavaDebugElementAdapterFactory.java:46)
	at org.codehaus.groovy.eclipse.GroovyPlugin.start(GroovyPlugin.java:122)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.lambda$2(BundleContextImpl.java:808)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:802)
	... 88 more

@eric-milles
Copy link
Member

Eclipse 4.22:
public Map<String, List<IAdapterFactory>> getFactories() {

Eclipse 4.21:
public HashMap<String, List<IAdapterFactory>> getFactories() {

It seems you have a misalignment between Eclipse IDE and Groovy Development Tools.

eric-milles added a commit that referenced this issue Jan 13, 2022
@JacquesLeRoux
Copy link

JacquesLeRoux commented Jan 14, 2022

Hi @eric-milles,

I use Eclipse 4.22, so I followed your advice:

When you use auto-update to cross major versions of eclipse, the Groovy Development Tools JDT patch gets out of sync. You need a newer update site link for Eclipse 2021-12: https://dist.springsource.org/snapshot/GRECLIPSE/e4.22

and got this error. Then I uninstalled Groovy, got back to what Marketplace suggests (ie Version: 4.4.0.v202112311714-e2112-RELEASE) and still got the same error.

In our project (Apache OFBiz) we still use Groovy 2.5.11, so I tried to install GDT 3.5.0. Eclipse refused and suggested something else. It worked. I have now a mix of installed versions (3 4.50 and 1 4.40) but at least it works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants