

Table of Contents
1. Overview
This article is about how to debug the spring boot application remote server or we can say if want to debug spring boot application from production or staging server than how it can be possible. So many times just because of some production issue we need to debug the application but from production servers. Production server generally from Linux OS without any GUI then how we can archive our requirement to debug a Java or Spring boot application form remove?
In this article, we have used the IntelliJ for remote debugging, you may use your favorite IDE as well.
2. Example
Step 1: Start the application in debug mode:
Here is the command using we can start the spring boot application in debug mode. Here address
indicates port in which application starts in debug mode and it’s not HTTP port, Our application starts on application HTTP port but address
used only for the debugging of the application.
agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
Here is a complete command to start spring boot application in debug mode:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar .\spring-boot-hibernate-example-1.0-SNAPSHOT.jar
It will print on the screen Listening for transport dt_socket at address: 5005
Step 2: Bind remote application with IntelliJ and start debugging
- Go to Edit Configurations
- Update Name, i.e Remote Debug
- Click on “+” sing
- Select “Remote” option
- Update host (Write your remote host address), There will be the default port 5005, No need to change this port if you have used the above command other. Make sure that there should be the same command that we have used in address (
address=5005
) - Press on “Ok” button
- Now click on debug button, it will give output in console:
Connected to the target VM, address: 'HOST_NAME:5005', transport: 'socket'
- Add debug point in code and try to reach that code, you will see the application will wait for your input once execution reach there.
3. Conclusion
Here we have learned how we can debug the spring boot application from production or staging server using IntelliJ IDE,