我卡住了。我无法弄清楚是什么原因导致我收到SWT包的“未解决的需求:需求-功能”错误(如果我深入挖掘的话,还有其他错误)。声明的需求是win32 os和ws,以及x86_64的arch,所有这些似乎都应该由我的系统来满足。我已经包括了下面的细节,并将更新与任何人要求的细节。
背景和问题细节
我正在做一个Eclipse插件项目,它已经很长时间没有导出了。自上次发布以来,它从Java 7升级到了8,从Juno升级到了火星。上周,我使用.product文件中的“EclipseProductExport向导”制作了一个新版本。以前的版本还不错。从Eclipse内部启动项目很好(使用产品文件上下文菜单运行为->Eclipse应用程序来创建启动配置)。在.product和启动配置中都可以看到,使用验证插件功能没有问题。
日志显示如下:
!SESSION 2016-08-05 09:50:28.847 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_101
java.vendor=Oracle Corporation
BootLoader constants: OS=${target.os}, ARCH=${target.arch}, WS=${target.ws}, NL=en_US
Framework arguments: -enableassertions
Command-line arguments: -os ${target.os} -ws ${target.ws} -arch ${target.arch} -clean -consoleLog -enableassertions -console
!ENTRY org.eclipse.osgi 4 0 2016-08-05 09:50:30.975
!MESSAGE An error occurred while automatically activating bundle org.eclipse.ui.workbench (96).
!STACK 0
org.osgi.framework.BundleException: Error starting module.
at org.eclipse.osgi.container.Module.doStart(Module.java:580)
...
Caused by: java.lang.NoClassDefFoundError: org/eclipse/swt/SWTError
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.eclipse.osgi.internal.framework.BundleContextImpl.loadBundleActivator(BundleContextImpl.java:755)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:706)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:941)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:318)
at org.eclipse.osgi.container.Module.doStart(Module.java:571)
... 42 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.SWTError cannot be found by org.eclipse.ui.workbench_3.107.0.v20150825-2206
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:439)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 51 more
Root exception:
java.lang.NoClassDefFoundError: org/eclipse/swt/SWTError
...
!ENTRY org.eclipse.osgi 4 0 2016-08-05 09:50:30.988
!MESSAGE An error occurred while automatically activating bundle ca.uvic.chisel.atlantis (2).
!STACK 0
org.osgi.framework.BundleException: Error loading bundle activator.
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:711)
etc etc...我可以访问osgi ,并获得了更多信息:
osgi> ss org.eclipse.swt
"Framework is launched."
id State Bundle
82 RESOLVED org.eclipse.swt_3.104.1.v20150825-0743
113 INSTALLED org.eclipse.swt.win32.win32.x86_64_3.104.1.v20150825-0743
osgi> diag 113
org.eclipse.swt.win32.win32.x86_64 [113]
Unresolved requirement: Require-Capability: eclipse.platform; filter:="(& (osg
i.ws=win32) (osgi.os=win32) (osgi.arch=x86_64))"Some more details on SWT on my system...the exported application has "/plugins/org.eclipse.swt.win32.win32.x86\_64\_3.104.1.v20150825-0743.jar", which is the same version specified by the org.eclipse.swt.win32.win32.x86\_64 entry in the .product file's "Plug-ins and Fragments" config. (There is also org.eclipse.swt\_3.104.1.v20150825-0743.jar and matching org.eclipse.swt). The bundle fragment requirements are as noted in the osgi console results, namely "(& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86\_64))".
In the previous (functioning) release from my archives, I see it has org.eclipse.swt.win32.win32.x86\_64\_3.100.1.v4234e.jar. I do not know if the bundle fragment requirements were the same or different back then. I do not have access to the osgi console in this release, because I did not include the necessary libraries for it back then.
Looking at other bundles, I saw some that are not RESOLVED status either.
**Development Context**
I am developing, exporting, and running the project on Windows 7. My JRE System Library for dev is jre1.8.0\_101-b13. This is the same version (same file path) as the JRE installed for running Java applications.
```javascriptC:\亚特兰蒂斯出口\亚特兰蒂斯0.3.0测试3>java -XshowSettings:properties -version
属性设置:
awt.toolkit = sun.awt.windows.WToolkitfile.encoding = Cp1252file.encoding.pkg = sun.iofile.separator = \java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironmentjava.awt.printerjob = sun.awt.windows.WPrinterJobjava.class.path = .java.class.version = 52.0java.endorsed.dirs = C:\Program Files\Java\jre1.8.0_101\lib\endorsedjava.ext.dirs = C:\Program Files\Java\jre1.8.0_101\lib\ext C:\Windows\Sun\Java\lib\extjava.home = C:\Program Files\Java\jre1.8.0_101java.io.tmpdir = C:\Users\eric\AppData\Local\Temp\java.library.path = C:\ProgramData\Oracle\Java\javapath C:\Windows\Sun\Java\bin C:\Windows\system32 C:\Windows C:\ProgramData\Oracle\Java\javapath C:\Windows\system32 C:\Windows C:\Windows\System32\Wbem C:\Windows\System32\WindowsPowerShell\v1.0\ C:\Program Files (x86)\pgmodeler C:\WinPython-64bit-3.4.3.5\python-3.4.3.amd64 %USERPROFILE%\.dnx\bin C:\Program Files\Microsoft DNX\Dnvm\ C:\Program Files\nodejs\ C:\Program Files (x86)\Skype\Phone\ C:\Windows\System32\WindowsPowerShell\v1.0\ C:\Program Files\010 Editor C:\Users\eric\AppData\Roaming\npm .java.runtime.name = Java(TM) SE Runtime Environmentjava.runtime.version = 1.8.0_101-b13java.specification.name = Java Platform API Specificationjava.specification.vendor = Oracle Corporationjava.specification.version = 1.8java.vendor = Oracle Corporationjava.vendor.url = http://java.oracle.com/java.vendor.url.bug = http://bugreport.sun.com/bugreport/java.version = 1.8.0_101java.vm.info = mixed modejava.vm.name = Java HotSpot(TM) 64-Bit Server VMjava.vm.specification.name = Java Virtual Machine Specificationjava.vm.specification.vendor = Oracle Corporationjava.vm.specification.version = 1.8java.vm.vendor = Oracle Corporationjava.vm.version = 25.101-b13line.separator = \r \nos.arch = amd64os.name = Windows 7os.version = 6.1path.separator = ;sun.arch.data.model = 64sun.boot.class.path = C:\Program Files\Java\jre1.8.0_101\lib\resources.jar C:\Program Files\Java\jre1.8.0_101\lib\rt.jar C:\Program Files\Java\jre1.8.0_101\lib\sunrsasign.jar C:\Program Files\Java\jre1.8.0_101\lib\jsse.jar C:\Program Files\Java\jre1.8.0_101\lib\jce.jar C:\Program Files\Java\jre1.8.0_101\lib\charsets.jar C:\Program Files\Java\jre1.8.0_101\lib\jfr.jar C:\Program Files\Java\jre1.8.0_101\classessun.boot.library.path = C:\Program Files\Java\jre1.8.0_101\binsun.cpu.endian = littlesun.cpu.isalist = amd64sun.desktop = windowssun.io.unicode.encoding = UnicodeLittlesun.java.launcher = SUN_STANDARDsun.jnu.encoding = Cp1252sun.management.compiler = HotSpot 64-Bit Tiered Compilerssun.os.patch.level = Service Pack 1sun.stderr.encoding = cp437sun.stdout.encoding = cp437user.country = USuser.dir = C:\Atlantis Export\Atlantis 0.3.0 TEST 3user.home = C:\Users\ericuser.language = enuser.name = ericuser.script =user.timezone =user.variant =java版本"1.8.0_101“
Java(TM) SE运行时环境(build 1.8.0_101-b13)
Java HotSpot(TM) 64位服务器VM (build 25.101-b13,混合模式)
我又试着从火星升级到霓虹灯。这没能解决任何问题。降级到朱诺来解决类似的问题闻起来像是个错误的解决方案。
发布于 2016-08-05 17:53:36
So...while在准备我的答案时,我找到了解决办法。我知道,如果我以前有个人跳过这个,那我可能就会想到。
我注意到${target.ws}和${target.os}发生在启动配置中。我不确定这些参数是如何添加的;也许产品文件生成了这些参数,也许我是在许多年前试图修复另一个bug时添加它们的。在任何情况下,我都在谷歌上查看如何检查这些值,并决定简单地删除它们,然后在没有它们的情况下测试启动和导出。两人都工作得很好。我不需要它们,我不确定它们是否包含了价值。
重申一下,我的解决方案是删除.product文件中的"-os ${target.os} -ws ${target.ws} -arch ${target.arch}“参数(以及由此派生的启动配置)。
我可能是根据这样的建议添加它们的(但我不知道为什么):Eclipse Validation error - Platform filter did not match:(&(osgi.ws=win32)(osgi.os=win32)(osgi.arch=x86))。看看归咎,我发现这些参数是在我第一次将项目从使用手动定义的启动配置更改为使用基于.product的启动配置时添加的;在手动定义启动时存在不一致和机器依赖的字符串。我不知道它们是自动添加的,还是我认为我需要它们。
https://stackoverflow.com/questions/38795218
复制相似问题