Debugging bundles at run time using the command-line console

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.

About this task

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 that is 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.

Procedure

  1. Start the OSGi Applications command-line console.
    At a command prompt, run the osgiApplicationConsole.bat command (for Windows systems) or the osgiApplicationConsole.sh command (for Linux systems). This command is in the install_dir/feature_packs/aries/bin/ directory, and takes the following optional parameters:
    -h The host name of the target machine. For example, machine1.hursley.ibm.com.
    -o The port number of the SOAP port of the target server. For example, 8880.
    -u The user ID, if the wsadmin connection is secured.
    -p The password, if the wsadmin connection is secured.
    For example:
    install_dir/feature_packs/aries/bin/osgiApplicationConsole -h machine1.hursley.ibm.com -o 8880
    The wsadmin command prompt is displayed. This instance of wsadmin recognizes OSGi Applications console commands.
  2. Connect to an available framework.

    You use the connect command to connect to a specific framework.

    If you know the framework name and version number, and the node and server on which the framework is running, you can use this information to connect. For example:
    wsadmin>connect("com.ibm.ws.eba.helloWorldService.eba", "1.0.0", "wasNode1", "server1")
    Alternatively, use the list command to list all available frameworks and to provide a unique ID for each framework, then use this ID to connect. For example:
    1. List all available frameworks:
      wsadmin>list()
      If you are connecting to an individual application server, the previous 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
    2. Connect to the com.ibm.ws.eba.helloWorldService.eba framework:
      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.

  3. Work with the connected framework.
    Use one or more of the following commands to work with the framework to which you are connected:
    • List all available frameworks, and indicate the currently connected framework.
      Use the list command:
      wsadmin>list()
      The previous 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
    • Display summary information about each of the bundles in the framework.
      Use the ss command:
      wsadmin>ss()
    • Display comprehensive information about all of the bundles in the framework.
      Use the bundles command:
      wsadmin>bundles()
    • Display comprehensive information about a given bundle in the framework.

      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.

      For example:
      wsadmin>bundle(1)
    • Display header information about a given bundle.

      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.

      For example:
      wsadmin>headers(1)
    • Display information about the packages that are imported or exported by the framework.
      Use the packages command. Optionally, specify either or both of the following parameters to select a particular package or subset of packages:
      bundle ID
      Display information about the exported packages for this bundle.
      The bundle ID values are one of the outputs of the ss command.
      package name
      Display information about the specified package.
      For example:
      wsadmin>packages()
      wsadmin>packages(2)
      wsadmin>packages("a.b.c")
    • Display information about all of the services that are currently registered by the framework.
      Use the services command. Optionally, specify either or both of the following parameters to select a particular service or subset of services:
      service ID
      Display information about a specified service.
      filter
      Display information about all services that match the filter.
      The filter must comply with the OSGi filter format as defined in the OSGi specification..
      For example:
      wsadmin>services()
      wsadmin>services(6)
      wsadmin>services("&(prop1=1)(prop2=2)")
    • Update the cached runtime information about the framework.
      It can take some time for the system to gather the runtime information about the framework and the bundles running within it. Therefore, when you run the osgiApplicationConsole command, the command-line console caches the runtime information. If you make changes to the currently selected framework, for example by updating or adding bundles, these changes are not reflected in the output of the command-line console commands until you run the refresh command:
      wsadmin>refresh()
    • Start a bundle.

      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.

      Note:
      • The OSGi Applications command line console is intended primarily as a method of debugging applications. In a production environment, you would normally use the administrative console or equivalent administrative commands to start and stop applications.
      • Do not use the start command on any bundles under the shared bundle framework, on system bundles, or on bundles that represent applications (bundle ID 0 and 1), because this can cause serious errors.
      For example:
      wsadmin>start(2)
    • Stop a bundle.

      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.

      Note:
      • The OSGi Applications command line console is intended primarily as a method of debugging applications. In a production environment, you would normally use the administrative console or equivalent administrative commands to start and stop applications.
      • Do not use the stop command on any bundles under the shared bundle framework, on system bundles, or on bundles that represent applications (bundle ID 0 and 1), because this can cause serious errors.
      For example:
      wsadmin>stop(2)
    • Display help information about the console commands.
      Use the help command to display a summary of the runtime commands and their uses:
      wsadmin>help()

Icon that indicates the topic type Task topic

Terms and conditions for information centers | Feedback


Timestamp icon Last updated: Saturday, 20 October 2012
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v700osgijpa&product=was-nd-mp&topic=ta_admin_runtime_console

Copyright IBM Corporation 2009, 2012.
This information center is powered by Eclipse technology. (http://www.eclipse.org)