Liferay Development

Liferay Consulting

Liferay Training

Your Trusted Liferay Solutions Partner

Saturday, February 29, 2020

Apache Gogo Shell Commands Description


lb
Display list of bundles installed in OSGi module framework

lb | grep <BUNDLE_MATCH_PATTERN>
List of bundles with filter using grep command and you can pass any string or valid regex pattern.

bundle <BUNDLE_ID>
Print specific bundle information. It required bundle Id as parameter

headers <BUNDLE_ID>
Print all OSGi headers which is used by specified bundle. These headers are in MANIFEST.MF file. It is required bundle Id as parameter.

install [URI_JAR_FILE_PATH]
Install bundle into OSGi container and we need to specify the valid URI path.

start [BUNDLE_ID]
Command will start bundle and it is required bundle Id.

stop [BUNDLE_ID]
Command will stop bundle and it is required bundle Id.

uninstall [BUNDLE_ID]
Uninstall bundle and it required bundle Id.

inspect requirement service [BUNDLE_ID]
List all services required by bundle. Require-Capability header is in MANIFEST.MF file is relevant to this command.

inspect capability service [BUNDLE_ID]
List all services provided by bundle. Provide-Capability header is in MANIFEST.MF file is related to this command.

diag [BUNDLE_ID]
Command will print unsatisfied constraints to specific bundle and its required bundle Id.

upgrade:check
Command will display all Upgrade Step Process Steps registered in the registry.

system:check
Command will show all unsatisfied components list along with Gogo shell commands to troubleshoot in detail. It will run Declarative Service Soft Circular Dependency Checker, Declarative Service Unsatisfied Component Checker, Spring Extender Unavailable Component Checker

history
history will print all commands used in the current session. It is similar to Unix/Linux history command.

help
It will show all available commands and its description.

services
Command will print all registered service components available in the OSGi module framework.

services grep [SEARCH-PATTERN]
Command will print all registered service components available in the OSGi module framework with filter. It will narrow down the list.

ds:unsatisfied
Command will display all unsatisfied service component list in the OSGi module framework.

ds:unsatisfied [BUNDLE_ID]
Command will display unsatisfied service components to specified bundle. It’s required bundle Id

scr:info [COMPONENT_ID]
Command will print detailed information of given component. It required the component Id and we can get component Id when we use services/ ds:unsatisfied commands.

scr:list
It will display all components registered in service registry.

scr:list | grep [SEARCH-PATTERN]
It will display matching components registered in service registry.

dm
List all dependency manager components and these are mostly service builder service components from Liferay OSGi Module Framework.

dm OR grep [SEARCH-PATTERN]
List all matching dependency manager components and these are mostly service builder service components from Liferay OSGi Module Framework.

dm cp OR  dm compact
Display components in compact from.

dm nd OR dm nodeps
Command will display only components and it is hiding dependencies of the component.

dm na OR dm notavail
It will print only not available dependency components. It is very useful when we troubleshoot unsatisfied service builder components.

dm wtf
Detects where are the root failures for components. This is also most useful command to troubleshoot service builder components

Example Usage of Commands

lb

lb | grep student

bundle 1076

headers 1076

install "file:C://Liferay/Liferay7.2/student-web/target/student-web-1.0.0.jar"

start 1076

stop 1076

uninstall 1076

inspect requirement service 1076

inspect capability service 1076

diag 1076

upgrade:check
system:check
history
help

services

services | grep student

ds:unsatisfied

ds:unsatisfied 1075

scr:info 4884

scr:list

scr:list | grep student

dm

dm | grep student

dm cp

dm nd

dm na

dm wtf

Author

Useful Apache Gogo Shell Commands in Liferay 7.2/DXP


Apache Gogo Shell is command line interface (CLI) to interact with OSGi module framework or OSGi container.

Apache Gogo shell is very useful in trouble shooting of module issues, getting module information and perform certain action like install, active and de-active OSGi bundles.

Liferay is already using Apache Gogo Shell and when we start Liferay 7.2/DXP portal, it will start automatically and we can use different ways to access Apache Gogo Shell in Liferay Portal Environment.


We can categorize Gogo shell commands in the following types.

Basic Commands
Declarative Services (DS) | Service Component Registry Commands (SCR) Commands
Dependency Management (DM) Commands

Basic Commands

Its regular usage commands to get bundles/module information like list bundles and its status.
Following are list of useful basic commands.


lb
lb | grep <BUNDLE_MATCH_PATTERN>
bundle <BUNDLE_ID>
headers <BUNDLE_ID>
install [URI_JAR_FILE_PATH]
start [BUNDLE_ID]
stop [BUNDLE_ID]
uninstall [BUNDLE_ID]
inspect requirement service [BUNDLE_ID]
inspect capability service [BUNDLE_ID]
diag [BUNDLE_ID]
upgrade:check
system:check
history
help

Example Usage


lb
lb | grep student
bundle 1076
headers 1076
install "file:C://Liferay/Liferay7.2/student-web/target/student-web-1.0.0.jar"
start 1076
stop 1076
uninstall 1076
inspect requirement service 1076
inspect capability service 1076
diag 1076
upgrade:check
system:check
history
help


Identify Bundle ID

Use lb command in the Gogo shell it will display the list of bundles installed in the OSGi modules framework. In the console view first column represent the BUNDLE ID.

Example


Declarative Services (DS) | Service Component Registry Commands (SCR)

Liferay module framework uses the OSGi Declarative Services/Service Component Registry to manage module components and its services references. Gogo shell leverage the Service Component Registry and Declarative Services. We can access services information using Gogo shell commands. 
In Liferay 7.2/DXP most of modules are using DS/SCR framework. Only service builder components are using the Apache Felix Dependency Management Framework to register and manage service components.

If you see any @Component or @Reference annotations in the java class, it implies that module components are using the Declarative Services/Service Component Registry Framework.

The following are some of useful Gogo Shell commands to insect components and its references.

services
services grep [SEARCH-PATTERN]
ds:unsatisfied
ds:unsatisfied [BUNDLE_ID]
scr:info [COMPONENT_ID]
scr:list
scr:list | grep [SEARCH-PATTERN]


Example Usage


services
services | grep student
ds:unsatisfied
ds:unsatisfied 1075
scr:info 4884
scr:list
scr:list | grep student


Identify COMPONENT ID

Use services/ ds:unsatisfied go shell commands and it will display component information and its ID.

Example 1


Example 2


Dependency Management (DM) Commands

Liferay Service Builder is using Apache Felix Dependency Management framework to manage components and its dependencies. Apache Gogo Shell leverage the Dependency Management framework and have set of predefined commands to provide more details of service components.
These commands are very useful when we trouble shoot about unsatisfied services in the registry.

The following are some of useful Gogo Shell commands related to Dependency Management

dm
dm | grep [SEARCH-PATTERN]
dm cp
dm nd
dm na
dm wtf


OR

dm
dm | grep [SEARCH-PATTERN]
dm compact
dm nodeps
dm notavail
dm wtf

Example Usage

dm
dm | grep student
dm cp
dm nd
dm na
dm wtf


Example usage screen



Reference


Author


Monday, February 24, 2020

Access Felix Gogo Shell in Liferay 7.2/DXP Portal Environment


Apache Felix Gogo shell is command line interface (CLI) to interact with Liferay Module Framework or OSGi container.

It will provide set of predefined commands to access bundle or modules information like list bundles installed in OSGi container, Services Registry Information and Dependency Management related details.

We have many ways to access the Apache Felix Gogo shell
  • Command Prompt in Windows
  • Putty Terminal
  • Liferay Blade CLI
  • From Liferay Portal Control Panel

Command Prompt in Windows

Make sure portal server should be started before start using Apache Gogo shell.

Open command prompt in windows and use following telenet command.

telnet localhost 11311

Use simple command lb it will list the bundles installed in the OSGi container.


Gogo shell using 11311 is default port number configured by Liferay Portal and we can change the port number as well.

Use disconnect to end the session.


Note:

Should not use shutdown, close, and exit commands in the Gogo shell and it will lead to showdown OSGi framework.

If you see “Telnet is not recognized as an internal or external command” enable Telenet in windows. Follow below link


Putty Terminal

We can also use putty terminal to connect to Gogo shell. If you don’t have putty, download portable putty from following link for windows and extract in local machine.


Click on putty executable and it will launch putty new session window.


Provide following details and open session and it will launch Gogo shell terminal.

Host Name: localhost
Port: 11311
Connection Type: telenet





Use help command to know about available commands.


Note:

We can also connect to remote host and need to provide valid remote host name or ip address.

Liferay Blade CLI

If Liferay Blade CLI already install simple use following command.

blade sh <gogo-shell-command>

Example


blade sh lb
blade sh help



If BLADE not installed follow below link.


From Liferay Control Panel

We can use Liferay Portal Control Panel to access Gogo shell. Login as Portal Admin and portal configuration, we can find Gogo shell app

Login As Portal Admin à Control Panel à Configuration à Click on Gogo Shell


Enter valid Gogo shell command as input and click on execute.


Author

Recent Posts

Recent Posts Widget

Popular Posts