Useful Equinox OSGi commands

Equinox is an implementation of the OSGi R4 core framework specification. This is the OSGi implementation which is used in WSO2 Carbon framework as well. Following commands are extremely useful in troubleshooting OSGi related issues.

ss (Ex: osgi> ss)
This command can be used to list all the existing bundles in the OSGi environment. Bundle ID, State and Bundle symbolic name of all the bundles are shown.

start <bundle-id> (Ex: osgi> start 16)
This command can be used to start a particular bundle. If it can’t be started, reasons are printed on the console.

stop <bundle-id> (Ex: osgi> stop 16)
This command can be used to stop a particular bundle. If it can’t be stopped, reasons are printed on the console.

b <bundle-id> (Ex: osgi> b 16)
This can be used to print all the meta data related to this bundle. That includes imported packages, exported packages, host bundle, required bundles etc.

diag <bundle-id> (Ex: osgi> diag 16)
This can be used to diagnose a particular bundle. It will show you the list of missing imported packages.

headers <bundle-id> (Ex: osgi> headers 16)
This can be used to list the headers for a particular bundle.

packages <package-name> (Ex: osgi> packages org.wso2.foo)
This can be used to list all the bundles which use the given package.

install file:<file-path> (Ex: osgi> install file:/home/temp/bundle1.jar)
This can be used to install a bundle into running OSGi environment. After installing, use ‘start’ command to activate the bundle.

uninstall <bundle-id> (Ex: osgi> uninstall 16)
This can be used to remove a bundle from the OSGi environment.

active (Ex: osgi> active)
This can be used to list all active bundles in the current instance.

refresh (Ex: osgi> refresh)
This can be used to refresh the system. All the package resolutions are refreshed when this is executed. Always refresh the system after uninstalling a bundle as a best practice.

Note : <bundle-symbolic-name> also can be used instead of <bundle-id> in above commands which uses <bundle-id> as a parameter.

Advertisements

About isurues
Age : 24 Date of Birth : 05.11.1984 Country : Sri Lanka

2 Responses to Useful Equinox OSGi commands

  1. sabir pasha says:

    I am getting bundle not found error on osgi console , when i try to start a bundle from osgi console . What should i do now ? I have my plugin in the / plugins directory

  2. isurues says:

    When you execute the ‘ss’ command on the OSGi console, do you see your bundle with an id? If yes, what is the status of the bundle? INSTALLED, RESOLVED or ACTIVE?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: