Steps to setup remote debugging on Cloud Foundry

I am able to successfully do remote debugging on cloud foundry using the below steps.

Steps to setup the Remote Debugging on cloud foundry.

1. Open your project in Eclipse.
2. Right-click on your project, go to Debug as and pick Debug Configurations.
3. Create a new Remote Java Application.
4. Make sure your project is selected, pick Standard (Socket Listen) from the Connection Type drop down and set a port. Make sure this port is open if you are running a firewall.
5. Click Debug.

The debugger should now be running. If you switch to the Debug perspective, you should see your application listed in the Debug panel and it should say Waiting for vm to connect at port.

Next, push your application to Cloud Foundry and instruct Cloud Foundry to connect to the debugger running on your local machine using the following instructions:
1. Edit your manifest.yml file. Set the instances count to 1. If you set this greater than one, multiple applications try to connect to your debugger.
2. Also in manifest.yml, add the env section and create a variable called JAVA_OPTS.
3. Add the remote debugger configuration to the JAVA_OPTS variable: -agentlib:jdwp=transport=dt_socket,address=<your-ip>:<your-port>.
4. Save the manifest.yml file.
5. Run cf push.

Upon completion, you should see that your application has started and is now connected to the debugger running in your IDE. You can now add breakpoints and interrogate the application just as you would if it were running locally.

By Sarah