Search code examples
eclipseosgiequinox

eclipse: Running a OSGI plugin as OSGI framework


I have created plugin project in eclipse from the hello world template, modified the sysout. Now I am trying to the run the project as OSGI framework. but I am getting below error:

Root exception:
java.lang.IllegalStateException: Workbench has not been created yet.
    at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92)

Any idea what could be the reason? Currently I am using Eclipse Juno 32bit version.


Solution

  • The problem is, this line of code is not getting called before some other code is trying to create or access workbench resources. Not sure what you modified but this line has to be executed in your Application class first. Maybe add a breakpoint on this line: and then a breakpoint for illegalstateexeception and see where the debeugger stops first. If at the exception then yes your code needs to be executed after the call to createAndRunWorkbench. I have seen this error before when trying to create things like jface wizards in my Application class before this line.

    PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());