Skip to Content
Technical Articles

Remote Debugging on Cloud Foundry

As we know that everything is moving to Cloud. And it has become a bottleneck for a developer to debug the application/ code on Cloud. In this article I will share how you can debug your applications directly deployed on Cloud Foundry.


  1. IntelliJ IDEA : I would recommend community version if you don’t have a license.
  2. Application should be deployed on Cloud Foundry.
  3. You should have the same code base in local, which is deployed on Cloud Foundry.


  1. Add below property in your mta.yaml for your module under property section:
    • JBP_CONFIG_JAVA_OPTS: “[from_environment: false, java_opts: ‘-Xms1300M -XX:NewSize=950M -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n’]”
  2. Open the command prompt (if you are using windows)/ Terminal(in case of Linux/Unix).
  3. Login to Cloud Foundry.
    • cf login -a (Canary Landscape).
    • cf login -a (Live Landscape).
  4. Navigate to your space where your application is deployed.
    • You can use this command to navigate: cf target -o <organisation name> -s <space name>
  5. After successfully navigating to space, you need to enable the ssh-tunnel for the application you want to debug.
    • cf enable-ssh <application name>
  6. Just to be sure, run the below command to see whether ssh is enabled for your application or not.
    • cf ssh-enabled <application name>
  7. Restage your application.
    • cf restage <application name>
  8. After successfully restaging the application run the below command.
    • cf ssh -N -T -L 8000:localhost:8000 <application name> 
  9. Open IntelliJ IDEA and import your project.
  10. Click on the Add Configuration to the top right corner as show in the picture below.
  11. Now click on the “+” button and choose “Remote”.
  12. After clicking on Remote you will another window. Set the pot as “8000” and “main” in “Use module classpath”.
  13. Now click “Ok” and Click on Debug icon on the top right corner.
  14. After clicking on the debug icon, you will see “Connected ” in the console of IntelliJ.
  15. Put the debug points in the desired file.

Now you are ready to debug your application. You can open your application and you will get a hit on your breakpoints.

Happy Debugging.

Note: Please let me know if you are facing some issues.



Achal Kansal

You must be Logged on to comment or reply to a post.