0

I'm currently working on updating a big program from Java 1.6 to 1.8. I'm also switching to a newer version of eclipse for this and had to struggle with quite a few workspace problems.

Anyway I'm currently stuck on one of the projects not being able to instantiate a class on lauch, because a jar that is in the projects Plug-in dependencies seemingly cannot find a class from a jar that is within the projects referenced libraries.

When trying to launch the project I'm getting the following stacktrace:

!ENTRY org.eclipse.osgi 4 0 2019-02-14 09:03:41.421
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in "at.jku.mevss.product" was unable to instantiate class "at.jku.mevss.product.application.DistributionServerApplication".
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:200)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:194)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:934)
    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.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:391)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:246)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:595)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1501)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1474)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/ui/application/WorkbenchAdvisor
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
    at java.lang.Class.getConstructor0(Class.java:3075)
    at java.lang.Class.newInstance(Class.java:412)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:190)
    ... 16 more
Caused by: java.lang.ClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.ui.workbench (116).
    at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:126)
    at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:557)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:331)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:39)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:414)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:153)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 21 more
Caused by: org.osgi.framework.BundleException: Error starting module.
    at org.eclipse.osgi.container.Module.doStart(Module.java:593)
    at org.eclipse.osgi.container.Module.start(Module.java:452)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:471)
    at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:117)
    ... 30 more
Caused by: java.lang.NoClassDefFoundError: org/eclipse/swt/SWTError
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
    at java.lang.Class.getConstructor0(Class.java:3075)
    at java.lang.Class.newInstance(Class.java:412)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.loadBundleActivator(BundleContextImpl.java:766)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:719)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1005)
    at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:357)
    at org.eclipse.osgi.container.Module.doStart(Module.java:584)
    ... 33 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.SWTError cannot be found by org.eclipse.ui.workbench_3.112.0.v20180906-1121
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:511)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:414)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:153)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 42 more
An error has occurred. See the log file
D:\RCPClients\MCC\.metadata\.log.

From my understanding within the product project the workbench.jar is unable to locate the SWTError class from the org.eclipes.swt.xxx.jar. I've confirmed that both jars are included in the references, though workbench is a Plug-in dependency, and org.eclipes.swt.xxx.jar is just a referenced library.

Do I possibly have to include org.eclipes.swt.xxx.jar somewhere else, so workbench.jar can properly access it? The same code was fully functional under Java 1.6, but I guess this is probably rather a problem in workspace setup, than a problem generated by trying to switch to 1.8.

Thanks in advance!

Radioo
  • 422
  • 5
  • 18
  • You say you have `org.eclipse.swt.win32.win32.x86` - that is 32 bit, is this a 32 bit build with a 32 bit Java? For 64 bit you need `org.eclipse.swt.win32.win32.x86_64` – greg-449 Feb 14 '19 at 10:29
  • @greg-449 Yes, I have just used the jar we are using in our working build on Java 1.6. I'm now pretty sure the problem might be, that one jar is just a referenced library while the other is a plug-in dependency. In our old project which is also in an older version of eclipse both are plug-in dependencies. I'm not quite sure how to add the swt jar as a plug-in dependency though. I tried to import all plugins to the workspace, but it doesn't seem to be catching the swt jar there. – Radioo Feb 14 '19 at 11:12
  • All swt jars should be in your target platform, not in the workspace. You shouldn't need to do anything different from any other Eclipse plugins. – greg-449 Feb 14 '19 at 11:16
  • I tried to set the target platform to our old version of eclipse, and it does automatically add the jar to plugin dependencies, but I still get a ClassNotFoundException on SWT Error. – Radioo Feb 14 '19 at 11:26

0 Answers0