Eclipse插件依赖性jar无法从引用的jar中找到类

时间:2019-02-14 09:18:21

标签: jar eclipse-plugin classnotfoundexception

我目前正在将一个大程序从Java 1.6更新到1.8。为此,我也要切换到新版本的Eclipse,并且不得不解决很多工作区问题。

无论如何,我目前仍停留在一个无法在lauch上实例化类的项目中,因为项目中的jar插件依赖项似乎无法从所引用项目中的jar中找到类。库。

尝试启动项目时,我得到以下堆栈跟踪:

!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.

据我了解,在产品项目中,workbench.jar无法从org.eclipes.swt.xxx.jar中找到SWTError类。 我已经确认两个jar都包含在引用中,尽管workbench是一个插件依赖项,而org.eclipes.swt.xxx.jar只是一个引用的库。

是否可能需要在其他位置包含org.eclipes.swt.xxx.jar,以便workbench.jar可以正确访问它? 相同的代码在Java 1.6下可以完全正常工作,但是我想这可能是工作区设置中的问题,而不是尝试切换到1.8时产生的问题。

谢谢!

0 个答案:

没有答案