Prepare the OSGi console for debugging and configure the
sample server to use in the deployment of your OSGi service.
About this task
After you configure the OSGi console, you can use it to install,
uninstall, stop, and start bundles in a running OSGi instance. There
are many useful commands available from the OSGi console to help you
debug problems that are associated with bundle initialization.
Procedure
- Configure the Liberty OSGi console:
- If your server is running, stop the server.
- Set the OSGi console port by adding the following line
to the bootstrap.properties file in <WLP_USER_DIR>/servers/server_name:
osgi.console=5471
- Add the OSGi console feature to the server.xml file
in <WLP_USER_DIR>/servers/server_name by
adding the following line in the <featureManager> section:
<feature>osgiconsole-1.0</feature>
- Start your server.
- Run the following shell command: telnet localhost
5471
On Windows,
if the Telnet Client is not active, first turn on the feature: open
the Control Panel, click Programs
and features, then click Turn Windows features
on or off, and select Telnet Client and
click OK.
- Enter the following command: ss. The installed bundles are displayed, similar to the following
partial list:
...
187 ACTIVE com.ibm.cis.sample.LoanServicesApi_1.0.0.0
188 ACTIVE OSGISampleSolution.modelExecutable_0.20.0.20140930140359
189 ACTIVE OSGISampleSolution.OSGISampleRuleAgent_0.20.0.20140930140359
190 ACTIVE OSGISampleSolution.init.loan.model.Customer_0.20.0.20140930140359
191 ACTIVE OSGISampleSolution.OSGISampleJavaAgent_0.20.0.20140930140359
192 ACTIVE OSGISampleSolution.solutionbundle_0.20.0.20140930140359
...
- Optional: To configure a cluster environment, specify a debug port for the server:
- Open a command window and change to the
<InstallDir>/runtime/ia/bin directory.
- Enter the following command:
propertyManager set --username=tester --password=tester debugPort=6543
Results
The server is configured and you can deploy OSGi services
on it.
Tip: You might want to copy the <InstallDir>/runtime directory
to save the settings for the OSGi console and the server. You can
then reuse this directory when you create a new OSGi service on another
server.