3.6. Troubleshooting
Check the status of a deployed bundle
After deploying an OSGi bundle, you can check its status using the
osgi:list
console command. For example:
JBossFuse:karaf@root> osgi:list
The most recently deployed bundles appear at the bottom of the listing. For example, a successfully deployed
cxf-basic
bundle has a status line like the following:
[ 232] [Active ] [ ] [Started] [ 60] Fabric8 :: CXF Code First OSGi Bundle (1.0.0.SNAPSHOT)
The second column indicates the status of the OSGi bundle lifecycle (usually
Installed
, Resolved
, or Active
). A bundle that is successfully installed and started has the status Active
. If the bundle contains a blueprint XML file, the third column indicates whether the blueprint context has been successfully Created
or not. If the bundle contains a Spring XML file, the fourth column indicates whether the Spring context has been successfully Started
or not.
Logging
If a bundle fails to start up properly, an error message is usually sent to the log. To view the most recent messages from the log, enter the
log:display
console command. Usually, you will be able to find a stack trace for the failed bundle in the log.
You can easily change the logging level using the
log:set
console command. For example:
JBossFuse:karaf@root> log:set DEBUG
Redeploying bundles with dev:watch
If there is an error in one of your bundles and you need to redeploy it, the best approach is to use the
dev:watch
command. For example, given that you have already deployed the cxf-basic
bundle and it has the bundle ID, 232, you can tell the runtime to watch the bundle by entering the following console command:
JBossFuse:karaf@root> dev:watch 232 Watched URLs/IDs: 232
Now, whenever you rebuild the bundle using Maven:
cd cxf-basic mvn clean install
The runtime automatically redeploys the bundle, as soon as it notices that the corresponding JAR in the local Maven repository has been updated. In the console window, the following message appears:
[Watch] Updating watched bundle: cxf-basic (1.0.0.SNAPSHOT)