Sie sind auf Seite 1von 5

Copy of Remote debug Spring boot application in Cloud

Install Spring Tool Suite (STS):

Install STS: Use version 3.7.2 and above.

Spring boot project:

Create a Spring boot project with version 1.3 and above. Sample project to try out:
Import maven project "gs-rest-service/complete" into workspace.
Check the version of Spring boot and ensure it is 1.3

Add 'devtool' feature to the project by Right-Clicking the project -> Sprint Tools -> Add Boot Devtools. This dependency can be
added manually also.
Save the project.

icon to open boot dashboard.

Note: To know more about boot dashboard feature please refer links in "Reference" section

Connect to Cloud Foundry Target

Right click in boot dashboard and click "Add a cloud foundry target".
Add cloud foundry url, email and password and click "Select Space".

Select Space and click finish

Ensure cloud foundry target is added to boot dashboard

Debug configuration:
Add debug configuration in manifest.yml
Replace the manifest.yml with the following code. Use different name for the application

- name: gs-rest-service
path: target/gs-rest-service-0.1.0.jar
JAVA_OPTS: "-Xdebug -Xrunjdwp:server=y,transport=dt_socket,suspend=n"

Deploying project to cloud via Spring boot dashboard:

Build the project using 'mvn clean install' command or from STS "Right-click on the project -> Run As -> Maven Install"
The project can be deployed to cloud using boot dashboard apart from using command line 'cf push'.
Drag the project from "Local" space to "cloud foundry space".

The project uploaded will be shown in the Cloud foundry space.

Remote DevTool client:

Start the Remote Devtool client by "Right-Clicking the instance in cloud foundry -> (Re)start Remote DevTools Client".

Ensure "RemoteSpringApplication" is started by looking in the console. If the application did not start, please see "Troubleshooting"

Debug configuration:
Click "Run -> Debug Configurations..."
Double click "Remote Java Application "

Enter name for the configuration -> select project, use default host and port (host: localhost, port:8000).
Click Apply
Click Debug

Debug the application:

Set breakpoints in in greetings method.

Enter the url in browser: http://<your base url>/greeting

The remote debug works as shown below.

Remote debug works in public/external network, not GE internal network. So please connect to public network and debug.
Cloud foundry account should be accessible from public network.
RemoteSpringApplication - did not start
One of the reason could be proxy is enabled in STS. Clear the proxy setting
Ensure the network is public/external.

Alternative Debugger:
Please follow the link for alternative debugger: Remote Debugging your Java microservice (or application)