1 Reply Latest reply: Dec 9, 2012 7:23 PM by jsmith RSS

    FXCanvas in SWT: NoClassDefFoundError

    976074
      Hi :)

      I have tried to embed a JavaFX-Button in a simple SWT View. After starting the plugin i get the following error:
       !SUBENTRY 1 org.eclipse.equinox.registry 4 1 2012-12-10 01:13:24.720
      !MESSAGE Plug-in "JFXPlugin" was unable to instantiate class "jfxplugin.views.SampleView".
      !STACK 0
      java.lang.NoClassDefFoundError: javafx/scene/Parent
           at java.lang.Class.getDeclaredConstructors0(Native Method)
           at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
           at java.lang.Class.getConstructor0(Class.java:2714)
           at java.lang.Class.newInstance0(Class.java:343)
           at java.lang.Class.newInstance(Class.java:325)
           at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:184)
           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.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:62)
           at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:112)
           at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPart(CompatibilityPart.java:249)
           at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:286)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
           at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:859)
           at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:839)
           at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111)
           at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:319)
           at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240)
           at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
           at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
           at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
           at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
           at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:141)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:896)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:630)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$6.run(PartRenderingEngine.java:518)
           at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:503)
           at org.eclipse.e4.ui.workbench.renderers.swt.ElementReferenceRenderer.createWidget(ElementReferenceRenderer.java:74)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:896)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:630)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
           at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
           at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$1.handleEvent(PartServiceImpl.java:96)
           at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
           at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
           at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
           at org.eclipse.swt.widgets.Display.syncExec(Display.java:4687)
           at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:187)
           at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
           at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
           at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
           at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
           at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
           at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
           at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
           at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
           at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
           at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81)
           at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
           at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
           at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
           at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:418)
           at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:385)
           at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:579)
           at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:558)
           at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:532)
           at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:521)
           at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:978)
           at org.eclipse.ui.internal.WorkbenchPage.showPart(WorkbenchPage.java:1203)
           at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1169)
           at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:3774)
           at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
           at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3771)
           at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3747)
           at org.eclipse.ui.handlers.ShowViewHandler.openView(ShowViewHandler.java:126)
           at org.eclipse.ui.handlers.ShowViewHandler.openOther(ShowViewHandler.java:99)
           at org.eclipse.ui.handlers.ShowViewHandler.execute(ShowViewHandler.java:67)
           at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
           at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:76)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
           at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:229)
           at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:210)
           at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131)
           at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171)
           at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:500)
           at org.eclipse.ui.internal.ShowViewMenu$3.run(ShowViewMenu.java:141)
           at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
           at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
           at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
           at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
           at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
           at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
           at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
           at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029)
           at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
           at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923)
           at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
           at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
           at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
           at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
           at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
           at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
           at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
           at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
           at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
           at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
           at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
           at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
           at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
           at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
      Caused by: java.lang.ClassNotFoundException: javafx.scene.Parent
           at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
           at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
           at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
           at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
           ... 119 more
       
      I have only added these lines to create the button:
       
      .
      .
      .
      
      public void createPartControl(Composite parent) {
      
                FXCanvas canvas = new FXCanvas(parent, SWT.NONE);
      
                Button button = new Button("My FXButton");
                Group group = new Group(button);
                Scene scene = new Scene(group);
                canvas.setScene(scene);
      
           }
      
      .
      .
      .
      Why he doesn't find the class?

      Thanks.
        • 1. Re: FXCanvas in SWT: NoClassDefFoundError
          jsmith
          The e(fx)clipse project states:
          Unfortunately, JavaFX was not written with OSGi in mind so there are various sources of error when running inside OSGi. These problems include the location of the JavaFX binaries in your Java installation and class loading issues because of OSGi's visibility rules. e(fx)clipse provides helper libraries for dealing with all of those problems
          You may also want to post on the e(fx)clipse forum as they tend to be specialists in SWT and JavaFX integration.

          http://efxclipse.org
          https://groups.google.com/forum/?fromgroups#!forum/efxclipse