Remote Debugging on Target Platform
ESF can be started with Java Debug Wire Protocol (JDWP) support, allowing the remote debugging of the developed application using Eclipse IDE. The procedure for remote debugging is presented in the following.
- Connect to the target platform (i.e. Reliagate 20-25) and stop the ESF application. Use
systemctl stop kura
. - Start ESF with Java Debug Wire Protocol (JDWP) by typing
/opt/eclipse/kura/bin/start_kura_debug.sh
. This will start Kura and open an OSGi console. It will also start listening for socket connections on port 8000.
Warning
Starting from Java 9, the JDWP socket connector accepts only local connections by default. To enable remote debugging on Java 9, the following line in
/opt/eclipse/kura/bin/start_kura_debug.sh
:
-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n \
has to be replaced with the following one:
-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=*:8000,suspend=n \
- Open the tcp port 8000 in the firewall, if it is not open yet. This can be done through the firewall tab in ESF web interface. Please refer to the following section to get the list of all the ports that can be used for ESF application development and debugging.
- Install your application bundle on the target platform.
- From Eclipse IDE, set a breakpoint in the application code at a point that will be reached (i.e. activation method, common logging statement, etc.). Then:
- Go to “Run -> Debug Configurations…”
- Select “Remote Java Application” and click the “New launch configuration” button
- For “Project:”, select the bundle project to be debugged
- For “Connection Type:”, select the default “Standard (Socket Attach)”
- For “Connection Properties:”, enter the IP address of the target platform and the tcp port 8000
- Click Debug
- Eclipse will connect to the target platform VM and switch to the Debug Perspective when the breakpoint will have been hit.
- To stop the remote debugging, select the “Disconnect” button from the Debug Perspective.
Updated 11 months ago