Remotely debugging the Query service
You can remote debug extensions to your Query service. This remote facility enables your developers to see the current state of variables, and leverage code hot swapping to see your changes reflected in the server as they develop code.
Before you begin
About this task
Perform the following steps to enable remote debugging on the Query service:
Procedure
-
Inside the Query service container, locate the jvm.options
file in
/opt/WebSphere/Liberty/usr/servers/default/jvm.option.
Add the following as a new line in this file:
The configurable parameters are:-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=7777
- address
- The debug port on which the eclipse debugger needs to attach to.
7777
is the default debug port for liberty server, user can change it to any other available port. - suspend=y
- Halts the server startup until a debugger attaches to the debug
port. If this behavior is not required, then
suspend=n
can be used. In that case the server will start normally while listening through the debug port for a debugger to attach at any point of time.
-
The debug port needs to be exposed in the query service container so that the
Eclipse debugger can attach to this port and communicate with the query service
application. You can do this by editing the
docker-compose.yml file. An example configuration is
below:
version '2.3' services: query: image: comlnx94.prod.hclpnp.com/9.1.9.0/search-query-app:v9-latest mem_reservation: 2g mem_limit: 3g ports: - "30900:30900" - "30901:30901" - "7777:7777"
-
In the eclipse project containing the source code of your Query service
extension, right-click on the project and navigate to
.Add your VM's IP address in the Host entry field and the debug port in the Port field. Ensure that Connection Type is set to
Socket Attach
. Click on Debug to attach your debugger to the query service’s listening debug port.Note: Do not keep remote debugging configurations enabled in the production environment as this has performance and security impacts. Remote debugging functionality should be used in development environments only. In addition, note that this remote debugging function only works with a local Docker runtime.