Where Is My Bundle
Sometimes when you start Eclipse, you don't see your bundle and you wonder why. This page will provide a short description of steps that you can take to debug this problem.
Steps To Get More Information
- Get a console. You will need to run Eclipse with java.exe instead of javaw.exe. If you are using Eclipse 3.3 or later, then use eclipsec.exe. The goal here is to get a DOS console. You can update your eclipse.ini file to include the -vm argument and point to java.exe. Note that whitespace is important in the eclipse.ini file so don't add extra whitespace to the ends of lines.
- Get the OSGi console. Run with the -console and -noexit command-line parameters. Again, it is probably easiest for you to add them to your eclipse.ini file. I always like to add -consoleLog for good measure. This basically means "anything you print to the log file, also print to the console".
- Start Eclipse. When you start Eclipse now, you should get a DOS console.
- Modify console buffer. Change the properties of the DOS console to show a lot of lines, we're going to have a lot of output here and we don't want things cut off.
- Get the system status. Now you should have a console with a
>osgiprompt. Here you can type
ssto get the status of all the bundles. You can also use a portion of a Bundle-SymbolicName with the
sscommand. For example,
ss org.eclipse.corewill get all bundles with a Bundle-SymbolicName starting with org.eclipse.core.
- Look for your bundle. Is your bundle in this list? If not, then OSGi doesn't know about it.
- Get the bundle status. Note the number on the far left column... this is the unique id that OSGi has assigned to your bundle. Write this down, you'll need it later. Also note what state your bundle is in. It should be one of
- Get more bundle information. If you type
bundle 123(where 123 is the bundle id for your bundle), then you will get lots of information about your bundle including which other bundles it is wired to because of its dependencies. You can also use the Bundle-SymbolicName, for example, if you type
bundle my.symbolic.name(where my.symbolic.name is the bundle symbolic name for your bundle), then you will get the same information.
- Not in the list - If your bundle isn't in the list, then OSGi doesn't know anything about it. See the next section for debugging this problem.
INSTALLED- This means that OSGi knows about your bundle but there is something wrong and it couldn't resolve. Problems may include thing from missing dependencies to requiring a higher Java VM version than you are running with.
RESOLVED- If your bundle is resolved but you expected it to be started, then try starting your bundle from the command-line with the
start 123command. If it won't start, then you should get some feedback as to what the problem is.
<<lazy>>- This means your bundle is resolved and is marked to be lazy started. Everything should be ok.
ACTIVE- your bundle is resolved and has been started, everything should be working as planned.
OSGi Can't See My Bundle
If your bundle isn't in the list when you do an
ss command on the OSGi console, then there are a couple of steps to take to diagnose the problem. Note that these steps are for Eclipse 3.3 and earlier.
OSGi - config.ini
In your Eclipse configuration area (by default a
configuration/ folder in the install directory) there is a file called
config.ini. This is a Java properties file which contains properties which are read by OSGi on startup. The important one for you right now is the
osgi.bundles property. This property lists the bundles that OSGi will see on startup and also sets their start level and tells OSGi whether or not to start them right away. By default, Eclipse will have 3 bundles on the list.
osgi.bundles=org.eclipse.equinox.common@2:start,\ org.eclipse.update.configurator@3:start,\ org.eclipse.core.runtime@start
org.eclipse.equinox.common bundle contains utilities and common classes used by other bundles.
org.eclipse.core.runtime bundle contains the application extension point and will help OSGi figure out which application to run. (for instance, the Eclipse SDK)
org.eclipse.update.configurator bundle actually does the work in discovering what other bundles you have, so we don't have to list everything on this list.
You should have at least these 3 bundles in your list.
Update - platform.xml
In your Eclipse configuration directory in the
org.eclipse.update folder, there should be a file named
platform.xml. This is the file that the Update Configurator uses to determine the rest of the bundles that are known to your system.
The file is organized into sites. You should see a site with the location of
platform:/base/ which basically means "everything from the
plugins/ folder in my Eclipse install directory". If you have created application extension locations via the update manager UI or if you have a
links/ folder then you will have a site entry for each one you have created.
If your bundle exists in an enabled site that is in the
platform.xml file, then everything should be ok. Note that the sites can list either features or plug-ins so you may need to know which feature your plug-in belongs to, in order to figure out if it should be known.