Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "SWTBot/OSGi Console"

(adding a page for diagnosing issues using the OSGi console)
 
m
Line 57: Line 57:
 
We'll now do the similar with ant:
 
We'll now do the similar with ant:
  
   osgi> ss org.apache.ant
+
   osgi> ss ant
 
    
 
    
 
   Framework is launched.
 
   Framework is launched.

Revision as of 21:43, 10 August 2010

Diagnose SWTBot Headless startup issues using the OSGi console

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.


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.

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.

Back to the top