【问题标题】:IllegalStateException raised when installing feature from zipped update site从压缩更新站点安装功能时引发 IllegalStateException
【发布时间】:2011-10-24 18:04:31
【问题描述】:

我正在尝试从命令行从压缩更新站点安装 Eclipse 功能。为此,我使用以下命令:

eclipsec.exe -nosplash -application org.eclipse.equinox.p2.director -repository jar:file:///d:\Eclipse_Workspaces\update-site-dummy_workspace\com.experiment.updatesite\experiment_update_site_1.0.0.zip!/ -installIU com.experiment.feature.one.feature.group -profile PlatformProfile

它可以工作,但是在安装过程结束之前它会出现这样的异常:

Installing com.experiment.feature.one.feature.group 1.0.0.
java.lang.IllegalStateException: Workbench has not been created yet.
        at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92)
        at org.eclipse.equinox.internal.provisional.p2.ui.ProvisioningOperationRunner.requestRestart(ProvisioningOperationRunner.java:171)
        at org.eclipse.equinox.internal.p2.ui.ProvUIActivator$1.notify(ProvUIActivator.java:117)
        at org.eclipse.equinox.internal.p2.core.ProvisioningEventBus.dispatchEvent(ProvisioningEventBus.java:108)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
        at org.eclipse.equinox.internal.p2.core.ProvisioningEventBus.publishEvent(ProvisioningEventBus.java:85)
        at org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry.broadcastChangeEvent(SimpleProfileRegistry.java:350)
        ....
Operation completed in 1277 ms.

请求的功能已安装,但我对这个异常感到难过 - 特别是它在某人的计算机上看起来不太好;)

Here我找到了一些关于这个异常的信息: “java.lang.IllegalStateException:工作台尚未创建

这通常发生在有人尝试使用 java -classpath .... 对 OSGi 包运行 Java 应用程序时。这实际上意味着工作台插件尚未启动,因此对 getWorkbench() 的调用失败。这本质上是一种竞争条件,可以通过表达对该捆绑包的显式依赖或将该捆绑包提升到比工作台更高的启动级别来解决。通常看不到,但如果是,那就是正在发生的事情。 "

我的问题是:有人知道如何解决这个异常吗?(例如,通过在 install 命令中添加一些 vm 选项)

PS 我使用的是 Eclipse 3.4,无法将其升级到更新版本。

【问题讨论】:

    标签: eclipse eclipse-rcp p2


    【解决方案1】:

    这是由于 org.eclipse.equinox.p2.ui 在您的环境中处于活动状态。默认情况下,您不会启动 Workbench,因此该包在 OSGi 运行时中应处于 Resolved 状态。我不确定为什么在你的环境中启动这个包,你可以检查文件 configuration/org.eclipse.equinox.simpleconfigurator/bundle.info,将包标记为不是自动启动。

    【讨论】:

    • 不幸的是已经设置为false。我没有注意它是一个UI插件。所以我认为删除 -nosplash 选项可能会有所帮助,但事实并非如此。无论如何 +1 的努力。
    • 一个技巧是从你的 Eclipse 中删除 org.eclipse.equinox.p2.ui。建议你使用最新的eclipse(比如3.7),director应用应该支持3.4生成的repository。
    【解决方案2】:

    今天我一直在努力解决这个问题,终于找到了解决方案。 install 命令中缺少-destination 参数,所以正确的是:

    eclipsec.exe -nosplash -application org.eclipse.equinox.p2.director -repository jar:file:///d:\Eclipse_Workspaces\update-site-dummy_workspace\com.experiment.updatesite\experiment_update_site_1.0.0.zip!/ -installIU com.experiment.feature.one.feature.group -profile PlatformProfile -destination .
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-17
      • 2018-09-06
      • 1970-01-01
      • 2014-11-29
      相关资源
      最近更新 更多