This blog post is mainly targeted at the WSO2 Carbon developers who make
use of OSGi console to debug their bundles/components during the
runtime. I'm here assuming that you have the basic shell which you would
find in equinox environment.
You can start any of the WSO2 server products (that is based on Carbon) with OSGi console enabled, by passing the system property 'osgiConsole' during the startup. To do so, start the carbon server with,
./wso2server.sh -DosgiConsole
After full server startup pressing enter in the command shell will give you the OSGi shell command prompt, which looks like;
osgi>
After that you can valid OSGi command using this shell. Let us explore some of those,
The below commands will help you while debugging bundles in 'Module Layer':
To debug OSGi services(Service Components) layer you can use the following commands.
You don’t have to memorize these commands; all the commands along with their documentation can be found using the OSGi console command ‘help’. This is just a quick reference guide. You can extend the available set of commands by writing your own command provider. Hope this helps.
You can start any of the WSO2 server products (that is based on Carbon) with OSGi console enabled, by passing the system property 'osgiConsole' during the startup. To do so, start the carbon server with,
./wso2server.sh -DosgiConsole
After full server startup pressing enter in the command shell will give you the OSGi shell command prompt, which looks like;
osgi>
After that you can valid OSGi command using this shell. Let us explore some of those,
The below commands will help you while debugging bundles in 'Module Layer':
Command | Use-Case |
---|---|
install file:/<filePath of bundle jar> | Install bundle jar in to runtime |
ss | To simply list down the bundles along with the life-cycle state we can use this command. |
start <bundleId found using ‘ss’ command> | starting the bundle given by bundle ID. |
b <bundleId> | Prints all the details attached with bundle including importing packages, exporting packages, etc. |
diag <bundleId> | If the bundle is still in installed state we can use this command to find the missing constraints which are stopping bundle going in to next lifecycle stage |
p <packageName> | List all the bundles that import/export the given package name within the runtime. |
stop <bundleId> | stopping the bundle given by bundle ID |
uninstall <bundleId> | uninstalling the bundle |
To debug OSGi services(Service Components) layer you can use the following commands.
Command | Use-Case |
---|---|
ls | list down all the service components found in this runtime along with their component ID and life-cycle status |
enable <componentID> | enabling service components |
comp <componentID> | Use this command to find unsatisfied services of the given component, which prevent it from going it to satisfied state. |
ls -c <bundleID> | same as the above command, but you can retrieve the information on your service components using the bundle ID instead of component ID |
services | list down all the
services in the runtime including services provided by the system
bundle. You can use simple filters to narrow down your list. eg: To find out the bundles/serviceComponents that expose the OSGi service ‘ org.foo.bar’ you can use the command: >services (objectclass=org.foo.bar) or >services (objectclass=*foo.bar) |
disable <componentID> | disabling component given by the component ID |
You don’t have to memorize these commands; all the commands along with their documentation can be found using the OSGi console command ‘help’. This is just a quick reference guide. You can extend the available set of commands by writing your own command provider. Hope this helps.
This is a good post!
ReplyDeleteThanks.... this little bit "./wso2server.sh -DosgiConsole" was exactly what I was looking for..
ReplyDeletethanks a lot
ReplyDeleteVery useful post :) thanks for sharing
ReplyDeletevery useful information, the post shared was very nice.
ReplyDeleteTIBCO Businessworks6x Online Training
Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts.
ReplyDeleteFull Stack Training in Chennai
Full Stack Course Chennai
Full Stack Training in Bangalore
Full Stack Course in Bangalore
Full Stack Training in Hyderabad
Full Stack Course in Hyderabad
Full Stack Training
Full Stack Course
Full Stack Online Training
Full Stack Online Course
Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts.
Full Stack Training in Chennai
Full Stack Course Chennai
Full Stack Training in Bangalore
Full Stack Course in Bangalore
Full Stack Training in Hyderabad
Full Stack Course in Hyderabad
Full Stack Training
Full Stack Course
Full Stack Online Training
Full Stack Online Course
Nice article,very useful information, the post shared was very nice.I also want to share some information about Signova
ReplyDeleteRekordbox DJ Crack as the name suggests, is a great DJ software. Useful for composing great music. This software provides a platform to. Rekordbox Dj Crack
ReplyDelete