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.

有帮助吗?

解决方案 2

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 .

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top