cloudsoft.io

Debugging in Cloudsoft AMP

Karaf can be started in debug mode with:

bin/karaf debug

You can then connect to port 5005 using your normal Java debugger.

If you want to change dt_socket port you can pass JAVA_DEBUG_PORT environment variable

JAVA_DEBUG_PORT=5006 bin/karaf debug

To pause startup until the debugger is connected you can use

JAVA_DEBUG_OPTS='-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005' bin/karaf debug

For other options please check your JVM JPDA documentation. Hotspot JPDA: https://docs.oracle.com/javase/8/docs/technotes/guides/jpda/

Start the AMP server in the background using the following command

bin/start

The Karaf container will keep state such as installed bundles and configuration between restarts. To reset any changes add clean to the CLI arguments.

With RPM it is pretty much the same however there are a few things you have to prepare.

  1. Export variables set in /lib/systemd/system/amp.service. Variables which are by default there. export KARAF_HOME=/opt/amp KARAF_ETC=/etc/amp AMP_PERSISTENCE_DIR=/var/lib/amp
  2. cd /opt/amp
  3. sudo -u amp -E /opt/amp/bin/karaf debug
  4. As mentioned in previous paragraph use JAVA_DEBUG_OPTS to set additional options like block Java startup until debugger is attached.