3

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?

Florian Wilhelm
  • 600
  • 4
  • 17
O. Merk
  • 113
  • 10

1 Answers1

7

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.

Christoph Schubert
  • 1,089
  • 1
  • 8
  • 16