Difference between revisions of "SWTBot/OSGi Console"

From Eclipsepedia

Jump to: navigation, search
m
m (Add the swtbot furniture on the page)
 
Line 1: Line 1:
 +
{{SWTBot}}
 +
 
== Diagnose SWTBot Headless startup issues using the OSGi console ==
 
== Diagnose SWTBot Headless startup issues using the OSGi console ==
  

Latest revision as of 17:17, 22 February 2011


SWTBot
Website
Update Sites
Community
Mailing List
Forums/Newsgroups
IRC
Contribute
Open Bugzilla tickets
Open Gerrit reviews
Browse Source
Continuous Integration


Contents

[edit] Diagnose SWTBot Headless startup issues using the OSGi console

[edit] Start the OSGi Console

Start the OSGi console, see Command Line arguments for the command line argument. Add '-console -noExit' to get the OSGi console:

$ java ...other args... \
  -console -noExit
...
...
...

Watch for any errors about missing missing dependencies.


[edit] The OSGi Console

You'll then get an OSGi prompt:

osgi> 

The shell is quite useful for getting insights into what is happening under the hood. Type 'help' at the prompt to get a listing of all supported commands.

We'll now list a short status(ss) of the swtbot bundles. Type ss org.eclipse.swtbot

 osgi> ss org.eclipse.swtbot
 
 Framework is launched.
 
 id	State       Bundle
 345	RESOLVED    org.eclipse.swtbot.eclipse.core_2.0.0.595-dev-e36
 346	<<LAZY>>    org.eclipse.swtbot.eclipse.finder_2.0.0.595-dev-e36
 347	<<LAZY>>    org.eclipse.swtbot.eclipse.spy_2.0.0.595-dev-e36
 348	ACTIVE      org.eclipse.swtbot.eclipse.ui_2.0.0.595-dev-e36
 349	RESOLVED    org.eclipse.swtbot.go_2.0.0.595-dev-e36
 350	RESOLVED    org.eclipse.swtbot.junit4_x_2.0.0.595-dev-e36
 351	<<LAZY>>    org.eclipse.swtbot.swt.finder_2.0.0.595-dev-e36
 359	RESOLVED    org.eclipse.swtbot.ant.optional.junit4_2.0.0.595-dev-e36
 	            Master=8
 360	ACTIVE      org.eclipse.swtbot.eclipse.junit4.headless_2.0.0.595-dev-e36

The following is a list of the bare minimum bundles needed to run SWTBot from the command line. Having these bundles is an absolute must.

 org.eclipse.swtbot.eclipse.core_2.0.0.595-dev-e36
 org.eclipse.swtbot.eclipse.finder_2.0.0.595-dev-e36
 org.eclipse.swtbot.junit4_x_2.0.0.595-dev-e36
 org.eclipse.swtbot.swt.finder_2.0.0.595-dev-e36
 org.eclipse.swtbot.ant.optional.junit4_2.0.0.595-dev-e36
 org.eclipse.swtbot.eclipse.junit4.headless_2.0.0.595-dev-e36

The following bundles are optional, nice-to-have:

 org.eclipse.swtbot.eclipse.spy_2.0.0.595-dev-e36
 org.eclipse.swtbot.eclipse.ui_2.0.0.595-dev-e36
 org.eclipse.swtbot.go_2.0.0.595-dev-e36

We'll now do the similar with ant:

 osgi> ss ant
 
 Framework is launched.
 
 id	State       Bundle
 8	RESOLVED    org.apache.ant_1.7.1.v20100518-1145
 	            Fragments=359
 ...
 ...
 359	RESOLVED    org.eclipse.swtbot.ant.optional.junit4_2.0.0.595-dev-e36
 	            Master=8

Notice that the ant bundle(org.apache.ant) is associated with the fragment(id 359). The fragment with id 359 is the ant junit4 bundle from swtbot.

In case this fragment is hooked up correctly and things should be fine, for the most part.

If the fragment bound to the ant bundle is not the swtbot-junit fragment, or the wrong junit version(v3 instead of v4), then it's probably a missing dependency for a bundle. See the initial startup errors for which bundles did not load because of missing dependencies.

[edit] Diagnosing missing dependencies

For such bundles with missing dependencies, you can diagnose further:

 osgi> diag org.eclipse.swtbot.swt.finder
 reference:file:plugins/org.eclipse.swtbot.swt.finder_2.0.0.595-dev-e36.jar [351]
   Direct constraints which are unresolved:
     Missing imported package junit.framework_4.3.0.
     Missing imported package org.junit_4.3.0.

Here it will tell you that a particular bundle cannot be loaded because some package imports are missing (in this case I removed all junit bundles). But you'll need to figure out transitive dependencies that are missing, it could be one tiny missing plugin that causes another plugin to not load, which causes another to not load and eventually causing swtbot to not start.