This is the sixth day of my participation in Gwen Challenge

Original: Telami’s Blog, welcome to share, reprint please reserve source.

Without further ado, above

First, open Edit Configurations and click the + sign to create a Remote application.

Fill in name, set Host address (remote server address) and port (select an unused port, then copy the Command line arguments for remote JVM for example port 5005:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005

This is optional, just select the corresponding JDK.

After the above steps, you have obtained the parameters to start the remote server. By default, Java commands are used when SpringBoot is started.

For example, the sample project startup command is:

nohup java -server -Xms492M -Xmx492M -jar wool-1.0. 0.jar &
Copy the code

Add the parameters obtained above to the start command:

nohup java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -server -Xms492M -Xmx492M -jar wool-1.0. 0.jar &
Copy the code

So the server listens on port 5005. You can run the following command to check whether the listening is successful:

[root @ izbp1c4fgtbk4x56zra24jz springboot] # netstat anp | grep TCP 5005 0 750 10.1.0.83:5005 11.167.22.247:56153 ESTABLISHED 32474/javaCopy the code

If the preceding information is displayed, the listener is successfully monitored.

However, if you are using a cloud server, make sure that a security group is configured. Otherwise, you will not be able to connect to this port.

The preceding steps have completed adding server parameters. Now start the Remote service configured just now, namely wool. When starting, we will find that the startup program only has the debug startup mode.

After the startup is complete, a breakpoint is made on the code that needs to be debugged. The remaining steps are to access the service request corresponding to the remote server, and the local system synchronizes the debugging. The rest of the operations are the same as local debug and will not be described here.