funfried/externalcodeformatter_for_netbeans

java.lang.ClassNotFoundException: org.eclipse.core.runtime.RegistryFactory if using org.eclipse.jdt.core.javaFormatter in .settings/org.eclipse.jdt.core.pref

markiewb opened this issue · 5 comments

java.lang.ClassNotFoundException: org.eclipse.core.runtime.RegistryFactory starting from ModuleCL@3f6f7c3d[de.markiewb.netbeans.plugins.eclipse.formatter] with possible defining loaders [Netigso[reference:file:ide/modules/org-eclipse-equinox-registry.jar], ModuleCL@3f6f7c3d[de.markiewb.netbeans.plugins.eclipse.formatter], Netigso[reference:file:ide/modules/org-eclipse-core-jobs.jar], Netigso[reference:file:ide/modules/org-eclipse-core-contenttype.jar], Netigso[reference:file:ide/modules/org-eclipse-core-runtime.jar], Netigso[reference:file:ide/modules/org-eclipse-equinox-preferences.jar], ModuleCL@6bf24094[org.netbeans.modules.netbinox], Netigso[reference:file:ide/modules/org-eclipse-equinox-common.jar]] and declared parents [ModuleCL@484f0b38[org.netbeans.api.progress], ModuleCL@22614c13[org.netbeans.api.debugger.jpda], ModuleCL@210452a0[org.netbeans.api.progress.nb], ModuleCL@34daabc5[org.netbeans.modules.editor], ModuleCL@50a3fb09[org.netbeans.modules.editor.lib2], ModuleCL@18b490ed[org.netbeans.api.debugger], ModuleCL@7aac7783[org.netbeans.modules.editor.mimelookup], ModuleCL@550bf368[org.netbeans.api.annotations.common], ModuleCL@78752ab5[org.netbeans.modules.projectapi], org.netbeans.MainImpl$BootClassLoader@31221be2, ...18 more]
    at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:228)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Caused: java.lang.NoClassDefFoundError: org/eclipse/core/runtime/RegistryFactory
    at org.eclipse.core.runtime.Platform.getExtensionRegistry(Unknown Source)
    at org.eclipse.jdt.core.ToolFactory.createCodeFormatter(Unknown Source)
    at org.eclipse.jdt.core.ToolFactory.createCodeFormatter(Unknown Source)
    at de.markiewb.netbeans.plugins.eclipse.formatter.strategies.eclipse.EclipseFormatter.format(EclipseFormatter.java:72)
    at de.markiewb.netbeans.plugins.eclipse.formatter.strategies.eclipse.EclipseFormatter.forCode(EclipseFormatter.java:61)
    at de.markiewb.netbeans.plugins.eclipse.formatter.strategies.eclipse.EclipseFormatterRunnable.run(EclipseFormatterRunnable.java:101)
    at de.markiewb.netbeans.plugins.eclipse.formatter.strategies.eclipse.EclipseFormatterStrategy.format(EclipseFormatterStrategy.java:49)
    at de.markiewb.netbeans.plugins.eclipse.formatter.strategies.FormatterStrategyDispatcher.format(FormatterStrategyDispatcher.java:100)
    at de.markiewb.netbeans.plugins.eclipse.formatter.actions.FormatAction.actionPerformed(FormatAction.java:71)
    at org.openide.awt.InjectorExactlyOne.actionPerformed(InjectorExactlyOne.java:78)
    at org.openide.awt.ContextAction$Performer.actionPerformed(ContextAction.java:226)
    at org.openide.awt.ContextManager.actionPerformed(ContextManager.java:260)
    at org.openide.awt.ContextAction.actionPerformed(ContextAction.java:109)
    at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:93)
    at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:116)
    at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99)
    at org.openide.awt.GeneralAction$BaseDelAction.actionPerformed(GeneralAction.java:234)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
    at java.awt.Component.processMouseEvent(Component.java:6535)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6300)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4891)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4713)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2750)
    at java.awt.Component.dispatchEvent(Component.java:4713)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Version: 1.10.2.0

This exception only occures if

  • ".settings/org.eclipse.jdt.core.pref" option in the plugin settings is checked AND
  • the project folder contains a ".settings/org.eclipse.jdt.core.pref" file with "org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter"

Workaround:

  1. Remove the org.eclipse.jdt.core.javaFormatter line OR
  2. Uncheck ".settings/org.eclipse.jdt.core.pref" option in the plugin settings

Possible solutions:

fixed in 1.11