I am wondering how to remote debug a S4SDK/Spring 2.0.6 Java Application deployed in SAP Cloud Foundry.
I am using Eclipse (Spring Tool Suite) and started the app in Debug Mode. The application will be restarted with the following environment variable: -Dspring.devtools.remote.secret=secret -Xdebug -Xrunjdwp:server=y,transport=dt_socket,suspend=n,address=47822
The console output shows, that after startup an SSH tunnel has automatically been created successfully (as a prerequisite I have enabled SSH using cf enable-ssh). and 'Successful remote access by 10.0.136.5:34858'.
After a few seconds, eclipse shows the message "Failed to connect to remote VM".
How to enable remote debugging?
This depends a bit on the buildpack you are using (see this link).
For the sap_java_buildpack you need to do the following:
jvmmon in your CF container:
cf ssh <app name> -c "app/META-INF/.sap_java_buildpack/sapjvm/bin/jvmmon"
In the opened CLI enter start debugging.
(Optional) Enter print debugging information to verify that debugging is enabled.
Exit the CLI with q.
To open the ssh tunnel enter cf ssh <app name> -N -T -L 8000:127.0.0.1:8000.
With that you can connect to your application via localhost:8000 by the usual means of your IDE.
As I have no experience with remote debugging in Eclipse I cannot help you with that part, in IDEA there is a special "Remote" Configuration where you can add the remote URL, so localhost:8000 in this case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With