You can use the wsadmin-based OSGi Applications command-line console to explore or debug the bundles associated with a specific OSGi application or shared bundle framework.
The OSGi Applications command-line console is a set of wsadmin commands that you can use to explore or debug a specific set of bundles running on an application server. As an aid to debugging applications in a test environment, the console also includes commands to start and stop bundles.
Every OSGi application that is currently running is viewed by the command-line console as a separate framework. On each application server that is running an OSGi application, there is also one shared bundle framework.
To work with a framework that is currently running, you first connect to the framework.
app_server_root/bin/osgiApplicationConsole -h machine1.hursley.ibm.com -o 8880
You use the connect command to connect to a specific framework.
wsadmin>connect("com.ibm.ws.eba.helloWorldService.eba", "1.0.0", "wasNode1", "server1")
wsadmin>list()
If
you are connecting to an individual application server, this command
might generate the following system response:ID Bundle Version Node Server
0 SharedBundles 7.0.0 wasNode1 server1
1 com.ibm.ws.eba.helloWorldService.eba 1.0.0 wasNode1 server1
2 com.ibm.ws.eba.obr.fep.eba5.eba 1.0.0 wasNode1 server1
3 com.ibm.ws.eba.wab.componenttest 1.0.0 wasNode1 server1
wsadmin>connect(1)
If the command completes
successfully it generates the following system responses:CWSAJ0035I: Connecting to framework com.ibm.ws.eba.helloWorldService.eba_1.0.0
on node wasNode1 and server server1.
CWSAJ0036I: Successfully connected to framework com.ibm.ws.eba.helloWorldService.eba_1.0.0.
To connect to a different framework, run the connect command again. You do not need to disconnect from one framework before connecting to another framework.
wsadmin>list()
This command might generate the
following system response:ID Bundle Version Node Server
0 SharedBundles 7.0.0 wasNode1 server1
1 com.ibm.ws.eba.helloWorldService.eba 1.0.0 wasNode1 server1 <== Connected
2 com.ibm.ws.eba.obr.fep.eba5.eba 1.0.0 wasNode1 server1
3 com.ibm.ws.eba.wab.componenttest 1.0.0 wasNode1 server1
wsadmin>ss()
ID State Bundle
0 ACTIVE org.eclipse.osgi_3.6.1.R36x_v20100806
1 ACTIVE com.ibm.samples.websphere.osgi.blog.app_1.0.0
2 ACTIVE com.ibm.samples.websphere.osgi.blog_1.0.0
3 ACTIVE com.ibm.samples.websphere.osgi.blog.persistence_1.0.0
4 ACTIVE com.ibm.samples.websphere.osgi.blog.web_1.0.0
5 ACTIVE com.ibm.samples.websphere.osgi.blog.api_1.0.0
wsadmin>bundles()
This
command might generate the following system response. org.eclipse.osgi_3.6.1.R36x_v20100806 [0]
Id=0, Status=ACTIVE Location=System Bundle
...
com.ibm.samples.websphere.osgi.blog.app_1.0.0 [1]
Id=1, Status=ACTIVE Location=com.ibm.samples.websphere.osgi.blog.app_1.0.0
...
com.ibm.samples.websphere.osgi.blog_1.0.0 [2]
Id=2, Status=ACTIVE
Location=reference:file:/C:/IBM/WebSphere/AppServer/profiles/profile01/
installedEBAs/com.ibm.samples.websphere.osgi.blog.app_1.0.0/byValue/
98b31e7a-4375-45fa-be20-d34b06f5c8b8.3/3/
Registered Services
{com.ibm.samples.websphere.osgi.blog.api.BloggingService}={service.id=46,
osgi.service.blueprint.compname=bloggingServiceComponent
}
{org.osgi.service.blueprint.container.BlueprintContainer}={osgi.blueprint.
container.symbolicname=com.ibm.samples.websphere.osgi.blog,service.id=47,
osgi.blueprint.container.version=1.0.0}
No services in use.
com.ibm.samples.websphere.osgi.blog.persistence_1.0.0 [3]
Id=3, Status=ACTIVE
Location=reference:file:/C:/IBM/WebSphere/AppServer/profiles/profile01/
installedEBAs/com.ibm.samples.websphere.osgi.blog.app_1.0.0/byValue/
98b31e7a-4375-45fa-be20-d34b06f5c8b8.1/1/
Registered Services
{javax.persistence.EntityManagerFactory}={osgi.unit.provider=org.apache.openjpa.
persistence.PersistenceProviderImpl,service.id=42,osgi.unit.name=blogExample,
osgi.unit.version=1.3.0,org.apache.aries.jpa.container.managed=true,org.apache.
aries.jpa.default.unit.name=false}
{javax.persistence.EntityManagerFactory}={osgi.unit.provider=org.apache.openjpa.
persistence.PersistenceProviderImpl,service.id=43,org.apache.aries.jpa.proxy.factory=true,
osgi.unit.name=blogExample,osgi.unit.version=1.3.0,org.apache.aries.jpa.container.managed=true,
org.apache.aries.jpa.default.unit.name=false}
{com.ibm.samples.websphere.osgi.blog.persistence.api.BlogPersistenceService}={service.id=44,
osgi.service.blueprint.compname=persistenceImpl}
{org.osgi.service.blueprint.container.BlueprintContainer}={osgi.blueprint.container.
symbolicname=com.ibm.samples.websphere.osgi.blog.persistence,service.id=45,
osgi.blueprint.container.version=1.0.0}
No services in use.
com.ibm.samples.websphere.osgi.blog.web_1.0.0 [4]
Id=4, Status=ACTIVE
Location=reference:file:/C:/IBM/WebSphere/AppServer/profiles/profile01/
installedEBAs/com.ibm.samples.websphere.osgi.blog.app_1.0.0/byValue/
98b31e7a-4375-45fa-be20-d34b06f5c8b8.2/2/
Registered Services
{javax.servlet.ServletContext}={service.id=48,osgi.web.contextpath=/blog,
osgi.web.version=1.0.0,osgi.web.symbolicname=com.ibm.samples.websphere.osgi.blog.web}
{org.osgi.service.blueprint.container.BlueprintContainer}={osgi.blueprint.container.
symbolicname=com.ibm.samples.websphere.osgi.blog.web,service.id=49,
osgi.blueprint.container.version=1.0.0}
No services in use.
com.ibm.samples.websphere.osgi.blog.api_1.0.0 [5]
Id=5, Status=ACTIVE
Location=reference:file:/C:/IBM/WebSphere/AppServer/profiles/profile01/
installedEBAs/com.ibm.samples.websphere.osgi.blog.app_1.0.0/byValue/
98b31e7a-4375-45fa-be20-d34b06f5c8b8.0/0/
No registered services.
No services in use.
Use the bundle command. Specify the ID of the bundle that you want to examine. The bundle ID values are one of the outputs of the ss command.
This command lists the information associated with the specified bundle. For example the bundle symbolic name, the bundle version, the services that the bundle registers, the services that are consumed by the bundle, and whether the bundle is a fragment or a host bundle.
wsadmin>bundle(3)
This command might generate
the following system response:com.ibm.samples.websphere.osgi.blog.persistence_1.0.0 [3]
Id=3, Status=ACTIVE
Location=reference:file:/C:/IBM/WebSphere/AppServer/profiles/profile01/
installedEBAs/com.ibm.samples.websphere.osgi.blog.app_1.0.0/byValue/
98b31e7a-4375-45fa-be20-d34b06f5c8b8.1/1/
Registered Services
{javax.persistence.EntityManagerFactory}={osgi.unit.provider=org.apache.openjpa.
persistence.PersistenceProviderImpl,service.id=42,osgi.unit.name=blogExample,
osgi.unit.version=1.3.0,org.apache.aries.jpa.container.managed=true,org.apache.
aries.jpa.default.unit.name=false}
{javax.persistence.EntityManagerFactory}={osgi.unit.provider=org.apache.openjpa.
persistence.PersistenceProviderImpl,service.id=43,org.apache.aries.jpa.proxy.factory=true,
osgi.unit.name=blogExample,osgi.unit.version=1.3.0,org.apache.aries.jpa.container.managed=true,
org.apache.aries.jpa.default.unit.name=false}
{com.ibm.samples.websphere.osgi.blog.persistence.api.BlogPersistenceService}={service.id=44,
osgi.service.blueprint.compname=persistenceImpl}
{org.osgi.service.blueprint.container.BlueprintContainer}={osgi.blueprint.container.
symbolicname=com.ibm.samples.websphere.osgi.blog.persistence,service.id=45,
osgi.blueprint.container.version=1.0.0}
No services in use.
No exported packages
Imported Packages
Imported Packages
com.ibm.samples.websphere.osgi.blog.persistence.api;
version="1.0.0"<com.ibm.samples.websphere.osgi.blog.api_1.0.0 [3]>
javax.persistence; version="1.1.0"<org.eclipse.osgi_3.6.1.R36x_v20100806 [3]>
No fragment bundles
No host bundles
No named class spaces
Required bundles
org.eclipse.osgi_3.6.1.R36x_v20100806 [0]
com.ibm.samples.websphere.osgi.blog.api_1.0.0 [5]
Use the headers command. Specify the ID of the bundle that you want to examine. The bundle ID values are one of the outputs of the ss command.
wsadmin>headers(2)
This command
might generate the following system response:Ant-Version = Apache Ant 1.7.1
Bundle-ActivationPolicy = lazy
Bundle-ManifestVersion = 2
Bundle-Name = Blog Core Services Bundle
Bundle-SymbolicName = com.ibm.samples.websphere.osgi.blog
Bundle-Vendor = IBM
Bundle-Version = 1.0.0
Created-By = 2.4 (Your Corporation)
Import-Package = com.ibm.samples.websphere.osgi.logging;version="[1.0.0,1.1.0)",
com.ibm.samples.websphere.osgi.blog.api;version="[1.0.0,1.1.0)",
com.ibm.samples.websphere.osgi.blog.comment.persistence.api;version="[1.0.0,1.1.0)",
com.ibm.samples.websphere.osgi.blog.persistence.api;version="[1.0.0,1.1.0)"
Manifest-Version = 1.0
wsadmin>packages()
wsadmin>packages(bundle_id)
wsadmin>packages(package_name)
wsadmin>packages(5)
This command might generate the following system response:com.ibm.samples.websphere.osgi.blog.persistence.api; version="1.0.0"
<com.ibm.samples.websphere.osgi.blog.api_1.0.0 [5]>
com.ibm.samples.websphere.osgi.blog_1.0.0 [2] imports
com.ibm.samples.websphere.osgi.blog.persistence_1.0.0 [3] imports
com.ibm.samples.websphere.osgi.blog.comment.persistence.api; version="1.0.0"
<com.ibm.samples.websphere.osgi.blog.api_1.0.0 [5]>
com.ibm.samples.websphere.osgi.blog_1.0.0 [2] imports
com.ibm.samples.websphere.osgi.blog.api; version="1.0.0"
<com.ibm.samples.websphere.osgi.blog.api_1.0.0 [5]>
com.ibm.samples.websphere.osgi.blog_1.0.0 [2] imports
com.ibm.samples.websphere.osgi.blog.web_1.0.0 [4] imports
wsadmin>packages("com.ibm.samples.websphere.osgi.blog.comment.persistence.api")
This
command might generate the following system response:com.ibm.samples.websphere.osgi.blog.comment.persistence.api; version="1.0.0"
<com.ibm.samples.websphere.osgi.blog.api_1.0.0 [5]>
com.ibm.samples.websphere.osgi.blog_1.0.0 [2] imports
wsadmin>services()
wsadmin>services(service_id)
wsadmin>services("(&(prop1=value_1)(prop2=value_2))")
wsadmin>services(2)
This command might generate the following system response:{org.osgi.service.packageadmin.PackageAdmin}={service.id=2,
service.ranking=2147483647,service.vendor=Eclipse.org - Equinox,
service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl}
Registered by bundle: org.eclipse.osgi_3.6.1.R36x_v20100806 [0]
Bundles using service:
org.eclipse.osgi_3.6.1.R36x_v20100806 [0]
wsadmin>services("(objectClass=org.osgi.service.packageadmin.PackageAdmin)")
This
command might generate the following system response:{org.osgi.service.packageadmin.PackageAdmin}={service.id=2,
service.ranking=2147483647,service.vendor=Eclipse.org - Equinox,
service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl}
Registered by bundle: org.eclipse.osgi_3.6.1.R36x_v20100806 [0]
Bundles using service:
org.eclipse.osgi_3.6.1.R36x_v20100806 [0]
wsadmin>services("(&(objectClass=javax.resource.Referenceable)(ibm.private.jndi.object=true))")
This
command might generate the following system response:{java.lang.reflect.InvocationHandler,com.ibm.websphere.rsadapter.WSDataSource,java.sql.Wrapper,
javax.sql.CommonDataSource,javax.resource.Referenceable,javax.sql.DataSource}={service.id=35,
osgi.jndi.service.name=jdbc/pgc,ibm.private.jndi.object=true}
Registered by bundle: org.eclipse.osgi_3.6.1.R36x_v20100806 [0]
No bundles using service.
{java.lang.reflect.InvocationHandler,com.ibm.websphere.rsadapter.WSDataSource,java.sql.Wrapper,
javax.sql.CommonDataSource,javax.resource.Referenceable,javax.sql.DataSource}={service.id=36,
osgi.jndi.service.name=jdbc/DefaultEJBTimerDataSource,ibm.private.jndi.object=true}
Registered by bundle: org.eclipse.osgi_3.6.1.R36x_v20100806 [0]
No bundles using service.
{java.lang.reflect.InvocationHandler,com.ibm.websphere.rsadapter.WSDataSource,java.sql.Wrapper,
javax.sql.CommonDataSource,javax.resource.Referenceable,javax.sql.DataSource}={service.id=39,
osgi.jndi.service.name=jdbc/lrsched,ibm.private.jndi.object=true}
Registered by bundle: org.eclipse.osgi_3.6.1.R36x_v20100806 [0]
No bundles using service.
{javax.resource.Referenceable,javax.resource.cci.ConnectionFactory}={service.id=40,
osgi.jndi.service.name=eis/jdbc/pgc_CMP,ibm.private.jndi.object=true}
Registered by bundle: org.eclipse.osgi_3.6.1.R36x_v20100806 [0]
No bundles using service.
wsadmin>refresh()
Use the stop command to stop the bundle specified by a given bundle ID. The bundle ID values are one of the outputs of the ss command.
wsadmin>stop(5)
This
command might generate the following system response:CWSAJ0042I: Stopping Bundle com.ibm.samples.websphere.osgi.blog.api_1.0.0.
CWSAJ0034I: Bundle com.ibm.samples.websphere.osgi.blog.api stopped successfully.
Use the start command to start the bundle specified by a given bundle ID. The bundle ID values are one of the outputs of the ss command.
wsadmin>start(5)
This
command might generate the following system response:CWSAJ0040I: Starting Bundle com.ibm.samples.websphere.osgi.blog.api_1.0.0.
CWSAJ0032I: Bundle com.ibm.samples.websphere.osgi.blog.api started successfully.
Use the help command to display a summary of the runtime commands and their uses.
wsadmin>help()
This command
generates the following system response:CWSAJ0025I: OSGi application console
Display commands: These commands work only if connected to a framework
ss() - This command gives the summary information about the installed bundles.
bundles() - This command gives comprehensive information about the installed bundles.
packages() - This command gives information about the imported/exported packages.
services() - This command gives information about the registered Services.
bundle(<bundleID>) - This command gives information about the specified bundle
headers(<bundleID>) - This command gives information about the headers associated with the
specified bundle
packages(<bundle ID>) - This command gives information about the exported packages for this bundle.
packages(<package Name>) - This command gives information about the specified package.
services(<service ID>) - This command gives information about the specified service.
services(<OSGI Filter>) - This command gives information about the services matching the filter.
refresh() - This command refreshes the internal OSGi application console cache with the latest
information about the state of the framework.
Framework commands:
list() - This command lists the available frameworks that you can connect to.
connect(<Framework id>) - This command connects to the specified framework.
connect(<Bundle Name>, <Bundle Version>, <Node Name>, <Server Name>)
- This command connects to the specified framework.
Controlling Bundles:
start(<bundleID>) - This command starts the requested bundle.
stop(<bundleID> - This command stops the requested bundle.