Reputation: 2996
I try to run OSGi plug in in Eclipse. It is empty bundle, but eclipse always send me errors There are my console messages http://pastebin.com/dqQfpQhd What is wrong?
Upvotes: 9
Views: 11503
Reputation: 389
I struggled a lot for “Workbench has not been created yet” the complete day.
But I got the solution by the following steps.-
Thanks
Upvotes: 5
Reputation: 76
The problem is that the default target includes many bundles that have nothing to do with your bundle -- typing the command ss
when all the error messages have finished will list them.
Here's what you do:
Upvotes: 6
Reputation: 23948
None of those errors have anything to do with your bundle. As you can see from the "Hello World" output, your bundle is starting just fine.
I believe you are launching Eclipse in the wrong way, probably eagerly activating all the bundles. Eclipse needs to start with most workbench bundles in "lazy activation" mode.
-console
to the eclipse.ini
file?MANIFEST.MF
from your own bundleconfig.ini
from ECLIPSE_HOME/configuration
eclipse.ini
from ECLIPSE_HOME
Upvotes: 2
Reputation: 114757
This is the main problem:
java.lang.IllegalStateException: Workbench has not been created yet.
You're using methods/objects from the workbench or related to the workbench while the workbench itself has not been created yet. Maybe you can delay the activation of the bundle or remove 'workbench' dependencies from the activation/initialisation part of the bundle.
Yikes, back to the beginning. The last line of the log containes a 'Hello World' - is this the expected output from your bundle? Maybe it's not your bundle that causes the errors and warnings on the output. I see some 'mylin' and other stuff too. If possible, add another clean installation of eclipse (no additional bundles/plugins) to your system and try the bundle in that environment.
From a good article on eclipsezone:
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.
What's the superclass of your own bundle? Because that could introduce a dependency on the workbench.
And - how do 'start' the bundle, from within eclipse or hav you jar'ed it up and put it in the eclipse plugin folder? That could make a difference too.
Upvotes: 3
Reputation: 32497
Try to do this before running your bundle:
if(!PlatformUI.isWorkbenchRunning()) {
PlatformUI.createAndRunWorkbench(PlatformUI.createDisplay(), new WorkbenchAdvisor() {...});
}
Upvotes: 0
Reputation: 12257
First check the dependencies of the empty plugin. May be you are missing to add a plugin, whcih is not loaded at runtime.
If you have dependencies in your plugin, check hich version of the plugins are used.
Which Java version you have defined in your plugin? Is it higher, than the version you are using at runtime?
Is your plugin loading DLLs? if so, check whether the DLL can be found at runtime.
Edit:
# Workbench has not been created yet. # at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92) # at org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin.start(MonitorUiPlugin.java:145)
What did you define in the start method of the Activator? It sems, that you are using the workbench which is not created yet.
Upvotes: 0