You can debug an application running on a Cloud Foundry container that uses SAP JVM.
-
Download and Install the Cloud Foundry Command Line Interface
-
Log On to the Cloud Foundry Environment Using the Cloud Foundry Command Line Interface
-
Deploy your application using SAP Java Buildpack 1. To do that, open cf CLI and run:
cf push <app name> -p <war file> -b sap_java_buildpack
-
Ensure that SSH is enabled for the application. See Accessing Apps with SSH
SAP JVM is included in SAP Java Buildpack 1. With SAP JVM, you can enable debugging on-demand without the need to set any debugging parameters, hence without having to restart the application or SAP JVM.
After enabling the debugging port, you need to open an SSH tunnel that connects to this port.
-
To enable debugging or to check the debugging state of your JVM, run
jvmmon
in your Cloud Foundry container by executing:cf ssh <app name> -c "app/META-INF/.sap_java_buildpack/sapjvm/bin/jvmmon"
-
From the
jvmmon
command line window, run:start debugging
-
(Optional) To confirm that debugging is enabled and see which port is open, run:
print debugging information
The following is an example of the information displayed by
jvmmon
:State: Debugging back is waiting for debugger to connect Port: 8000 Client: Globally accessible
The default port is 8000.
-
To exit
jvmmon
, run:q
-
To open the SSH tunnel, run:
cf ssh <app name> -N -T -L 8000:127.0.0.1:8000
Your local port 8000 is connected to the debugging port 8000 of SAP JVM running in the Cloud Foundry container.
The connection is active until you close the SSH tunnel. When you finish debugging, close the SSH tunnel by pressing [Ctrl] + [C] .
-
Connect a Java debugger to your application. For example, use the standard Java debugger provided by Eclipse IDE and connect to
localhost:8000