问题
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?
回答1:
This depends a bit on the buildpack you are using (see this link).
For the sap_java_buildpack
you need to do the following:
- Run the
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.
来源:https://stackoverflow.com/questions/54169124/remote-debugging-in-sap-cloud-foundry