Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remote Debugging in SAP Cloud Foundry

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?

like image 251
O. Merk Avatar asked Jun 14 '26 02:06

O. Merk


1 Answers

This depends a bit on the buildpack you are using (see this link).

For the sap_java_buildpack you need to do the following:

  1. Run the jvmmon in your CF container:
    cf ssh <app name> -c "app/META-INF/.sap_java_buildpack/sapjvm/bin/jvmmon"
    
  2. In the opened CLI enter start debugging.

  3. (Optional) Enter print debugging information to verify that debugging is enabled.

  4. Exit the CLI with q.

  5. To open the ssh tunnel enter cf ssh <app name> -N -T -L 8000:127.0.0.1:8000.

  6. 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.

like image 108
Christoph Schubert Avatar answered Jun 15 '26 15:06

Christoph Schubert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!