Remote Debug for Cloud Foundry application fails when connecting eclipse remote debugger to forwarded local port

Viewed 2939

I'm trying to remotely debug a Spring boot application deployed on a cloud foundry Instance. Below are the steps that I'm following to setup remote debug using eclipse:

  1. Setting up JBP_CONFIG_DEBUG: '{enabled: true}' environment variable for the application.
  2. After that I'm setting up the local port forwarding to my app container with cf ssh -N -T -L 8000:localhost:8000 <APP_NAME>
  3. Then I'm setting up the remote debug configuration in eclipse as shown below image:Eclipse remote debug setup

After that when I try to start remote debug session, It tried to connect to the app but fails with the message at the port forwarded terminal:

connect to localhost:8000 failed: ssh: rejected: connect failed (dial tcp 127.0.0.1:8000: getsockopt: connection refused)

Please help, if anyone has any clue about this error!!

3 Answers

You might have to restage the application for the change to take place, debug configuration to change.

You can use alternatively ssh into the container using cf ssh <application name> and check that the debug port is opened on not using netstat -an

We had some issues as well, but with a specific java buildback, but anyway mabe it'll help you in your case as well, try:

cf set-env <app-name> JBP_CONFIG_JAVA_OPTS '[java_opts: "-XX:+ForceDebuggingOnDemand"]'

cf restage <app-name>

try to change debugging port like this:

JBP_CONFIG_DEBUG "{enabled: true, port: 8001}"
Related