Manage OSGi Bundles

The adapter container is implemented as an OSGi container. The container manager tool is bundled along with Sterling B2B Integrator to manage the OSGi bundles inside the container.

To use OSGi Manager, run the following OSGi Manager command from the install_dir/bin directory:

OSGiManagerClient –nnodeName command bundle

Where:

nodeName is the name of the container that is configured by the setupContainer command.

command is either list, start, stop, install, or uninstall.

bundle is the .jar file that contains the bundle and must be present in install_dir/osgi/bundles directory. The bundle is required for all commands except list command.

The following are some examples of OSGi Manager commands and their output:
  • To display all bundles that are deployed on each adapter container JVM in the cluster for two nodes set up as node1AC1 and node1AC2 -

    ./osgiManager.sh list

    $osgiManager.sh list 
    Execute list on node1AC1:
    Known bundles:
    Bundle Name:    Location:       Version:        Status:
    System Bundle   System Bundle   1.2.1   ACTIVE
    AdapterJVM Bundle  file:/install_dir/osgi/bundles/container_bundle_2_1.jar  1.0.0  ACTIVE
    OSGi Command line Manager file:/install_dir/osgi/bundles/manager_bundle_2_1.jar 1.0.0  ACTIVE
    Execute list on node1AC2:
    Known bundles:
    Bundle Name:    Location:       Version:        Status:
    System Bundle   System Bundle   1.2.1   ACTIVE
    AdapterJVM Bundle file:/install_dir/osgi/bundles/container_bundle_2_1.jar  1.0.0  ACTIVE
    OSGi Command line Manager  file:/install_dir/osgi/bundles/manager_bundle_2_1.jar  1.0.0  ACTIVE
    
  • To display bundles deployed on adapter container node node1AC1 -

    ./osgiManager.sh -nnode1AC1 list

    $osgiManager.sh -nnode1AC1 list
    Execute list on node1AC1:
    Known bundles:
    Bundle Name:    Location:       Version:        Status:
    System Bundle   System Bundle   1.2.1   ACTIVE
    AdapterJVM Bundle file:/install_dir/osgi/bundles/container_bundle_2_1.jar  1.0.0  ACTIVE
    OSGi Command line Manager  file:/install_dir/osgi/bundles/manager_bundle_2_1.jar  1.0.0  ACTIVE
    
  • To stop the OSGi Manager on a specific adapter container node -

    ./osgiManager.sh -nnode2AC1 stop file:/install_dir/osgi/bundle/container_bundle_1_1.jar

  • To stop the OSGi Manager on all adapter container nodes -

    ./osgiManager.sh stop file:/install_dir/osgi/bundle/container_bundle_1_1.jar

  • To stop a customized bundle on all adapter container nodes -

    ./osgiManager.sh stop <bundle_location>

    Where, <bundle_location> is the URL returned by the ./osgiManager.sh list command.

    If it is not required to restart the bundle when the container node is restarted, ensure that you remove the name of the bundle .jar from the customer_overrides.properties file in each container.