从压缩更新站点安装功能时引发 IllegalStateException

发布于 2024-12-10 17:11:27 字数 1954 浏览 2 评论 0原文

我正在尝试从命令行从压缩的更新站点安装 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.

请求的功能已安装,但我对此异常感觉不好 - 特别是它在某人的计算机;)

在这里我找到了有关此异常的一些信息: “java.lang.IllegalStateException:工作台尚未创建。

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

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

PS 我正在使用 Eclipse 3.4 并在那里无法将其升级到更新的版本。

I'm experimenting with installing an Eclipse feature from the zipped update site from command line. To do this I use following command:

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

It works, however just before the end of installation process it rises an exception like this one:

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.

The requested feature is installed, but I feel bad about this exception - especially it won't look good on a someone's computer ;)

Here I found some information about this exception:
"java.lang.IllegalStateException: Workbench has not been created yet

This usually comes when someone tries to run a Java application against an OSGi bundle with java -classpath .... . It really means that the workbench plug-in hasn't started yet, and so calls to getWorkbench() fail. This is essentially a race condition, and can be solved by either expressing an explicit dependency on that bundle or bumping up that bundle to a higher start level than the workbench. Generally not seen, but if it is, that's what's happening. "

My question is: Does anyone have an idea how to work around rising this exception? (E.g. by adding some vm options to the install command)

PS I'm using Eclipse 3.4 and there is no way to upgrade it to something newer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别忘他 2024-12-17 17:11:27

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

It's caused by the bundle org.eclipse.equinox.p2.ui is active in your environment. By default you don't launch Workbench, so that bundle should be in Resolved state in OSGi runtime. I'm not sure why this bundle is started in your environment, you can check file configuration/org.eclipse.equinox.simpleconfigurator/bundle.info, mark the bundle as not auto start.

你的呼吸 2024-12-17 17:11:27

今天我一直在为这个问题苦苦挣扎,终于找到了解决方案。安装命令中缺少 -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 .

Today I've been struggling a bit with this problem and finally I found a solution. There was missing -destination argument in the install command, so the correct one is:

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 .
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文