How to Remotely Debug Java Applications on Cloud Foundry
search cancel

How to Remotely Debug Java Applications on Cloud Foundry

book

Article ID: 297928

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

This article applies to the following versions: Pivotal Cloud Foundry 1.8 and above. It provide instructions on how to enable remote debug configuration to Java applications on PCF at runtime. 

Note: Pivotal Cloud Foundry is now Tanzu Application Service (TAS) for VMs.

Environment

Product Version: 2.0

Resolution

1. Enable the JBP_CONFIG_DEBUG environment variable, this can be done by editing application manifest.yml or invoking the "cf set-env" command. In this article, we use application manifest as an example.

---
applications:
- name: <APP_NAME>
 memory: 512M
 instances: 1
 path: path/java-app.war
 env:
   JBP_CONFIG_DEBUG: '{enabled: true}'


2. Use "cf push" to deploy the Java application to PCF or Pivotal Web Services.

3. Set up the SSH tunnel for the debug framework via JDWP. 

cf ssh -N -T -L 8000:localhost:8000 <APP_NAME>


Once the SSH tunnel has been created, Eclipse/STS should connect to the localhost:8000 for debug access. Please refer to the detailed instructions in the Java Buildpack Debug Framework


 

These instructions are only useful in Diego-based containers with SSH access enabled. Diego was introduced in PCF v1.6.x and is mandatory in PCF v1.7.x. Additionally, the remote debug feature is only available from Java Buildpack v3.4+.
 

PCF is not a development platform, you can use it but it is going to be slow. Users should develop software locally and treat PCF as a deployment target. PCF Dev is provided to set up a compact PCF on a local machine for development/debugging use.

 

Additional Information

The instructions are only useful in Diego-based containers with SSH access enabled. Diego was introduced in PCF v1.6.x and turns to be mandatory in v1.7.x. Additionally, the remote debug feature is only available from Java Buildpack v3.4+.
 

PCF is not a development platform, you can use it but it is going to be slow. Users should develop software locally and treat PCF as a deployment target. PCF Dev is provided to set up a compact PCF on a local machine for development/debugging use.