Using an OSGi console

Eclipse Equinox currently provides an OSGi console that you can use to aid with debugging. This console is not available by default. You can enable this console in the OSGi framework that is running within Liberty by using the osgiConsole-1.0 feature and by specifying a port to attach to.

About this task

Liberty uses the Eclipse Equinox implementation of the OSGi core specification. Equinox currently provides an OSGi console. To enable this console, you first allocate a specific port to it by setting the osgi.console property in the bootstrap.properties file. Then you can use Telnet to connect to the console on that port, and explore the OSGi framework.

Procedure

  • Add the osgiConsole-1.0 Liberty feature to your server.xml file.
    <feature>osgiConsole-1.0</feature>
  • Allocate a specific port to the OSGi console.
    You set the OSGi console port by specifying the osgi.console property. You set this property as a bootstrap property in the bootstrap.properties file. See Specifying Liberty bootstrap properties.
    osgi.console=5471

    The OSGi console is disabled when the osgi.console property is not set.

  • Use Telnet to connect to the OSGi console port.
    telnet localhost 5471
  • Use the console to explore the framework.

    The available commands vary, depending on the OSGi framework being used. Command-line help provides enough information to get started.