错误Platform.getBundle(“”)。start();

时间:2012-01-28 04:50:44

标签: macos eclipse-rcp osgi bundle 32bit-64bit

我正在使用RCP,我的Application类中有这个'start'方法:

public class Application implements IApplication {
public Object start(IApplicationContext context) throws Exception {
    Display display = PlatformUI.createDisplay();

    try {
        // Enforcing that Spring Dynamic Modules extender is started
        Platform.getBundle("org.springframework.osgi.extender").start();  **//THIS IS LINE 26**
        int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
        if (returnCode == PlatformUI.RETURN_RESTART)
            return IApplication.EXIT_RESTART;
        else
            return IApplication.EXIT_OK;
    } finally {
        display.dispose();
    }

}
//More methods...
}

错误说:

!SESSION 2012-01-27 21:59:11.417 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_29
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86, WS=cocoa, NL=es_ES
Framework arguments:  -product com.blackthorne.mvctest.product -d32
Command-line arguments:  -product com.blackthorne.mvctest.product -data /Users/Hepale/Documents/Java/Wisconsin - ET/Eclipse/MVCTest/../runtime-com.blackthorne.mvctest.product -dev file:/Users/Hepale/Documents/Java/Wisconsin - ET/Eclipse/MVCTest/.metadata/.plugins/org.eclipse.pde.core/com.blackthorne.mvctest.product/dev.properties -os macosx -ws cocoa -arch x86 -consoleLog -d32

!ENTRY org.eclipse.osgi 4 0 2012-01-27 21:59:12.168
!MESSAGE Application error
!STACK 1
java.lang.NullPointerException
    at com.blackthorne.mvctest.Application.start(Application.java:26)
    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:369)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
An error has occurred.

我相信它是cos版本,但我在程序参数中添加了'-d32'(在运行配置中......) 我不知道遗失了什么。

任何能帮助我的人,我都很感激,因为这真的是一个紧急情况。

我知道在这个程序员的世界里,我们需要分享我们的疑虑和知识。

提前致谢;)

1 个答案:

答案 0 :(得分:1)

我会使用OSGi包的起始级别来确保捆绑包正确启动。您可以通过“配置”页面上的“产品配置”设置起始级别,也可以通过config.ini属性直接在osgi.bundles文件中设置起始级别。