Skip to content

Debuging with Karaf

Alejandro Medrano edited this page Mar 17, 2018 · 1 revision

How to debug your application with Karaf

course you, can debug your Of application. karaf can be started by enabling the remote debug, in particular Karaf will open a socket on a specific port and ip. Eclipse can attach to karaf via socket at runtime.

You need to:

  • start the universAAL release in debug mode: you can export the variable (this is done by default, it can also be added to your setenv script)
 export KARAF_DEBUG=true [LINUX]
 SET KARAF_DEBUG=true [WIN]
  • check the debug option on the script
 bin/karaf.sh [LINUX]
 bin/karaf.bat [WIN]

Look for the following properties in the script:

  DEFAULT_JAVA_DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006"

In this sample case it is 5006. In the latest version of the distro, Karaf will listen on port 5005.

  • Go to Eclipse and create a Debug Configuration of type Remote Java Application
  • Click on Debug
  • Then put some breakpoint in your code
  • Add, install and start the modules you wish to debug (as you would when running a normal karaf application)
  • Eclipse will automatically stop execution where you put your breakpoint, or when pressing the stop button.

please read documentation about the debug functionality to get the maximum out of it.