idea remote debugging

Use background:

        Since the local environment service is running normally, after it is deployed to the Linux server, the service reports an error. It is difficult to troubleshoot the problem at this time. The only way is to deploy the service to the Linux server again by logging locally and view the log. Troubleshoot error points;
this method is time-consuming and labor-intensive, and achieves twice the result with half the effort. Then we can directly debug the code on the Linux server through remote debugging.

Steps:

1, idea arrangement

(1) Add Remote JVM Debug (as shown below)

(2) Remote JVM Debug configuration (as shown below) 

 2. Server configuration

(1) Start the jar package with the following command:

 ★★★

nohup java -Xdebug -Xrunjdwp:transport=dt_socket,address=5500,server=y,suspend=y -Xms512m -Xmx1024m -jar smartpark-1.0.0.jar &

3. Operation summary

       (1) "5500" in the "  ★★★ " command is the monitored port number. This port number can be set at will, just make sure it is consistent with the one set in the idea.

(2) " smartpark-1.0.0.jar" in the        "  ★★★ " command needs to be replaced with the jar you need

       (3) After the service on the server is successfully started, the local service must also be started, and then a breakpoint is set locally and the server's interface is requested. At this time, the breakpoint is entered into the local service.

Parameter explanation:

-Xdebug: Notify the JVM to work in debug mode
-Xrunjdwp: Notify the JVM to use (java debug wire protocol) to run the debugging environment
transport=dt_socket: Refers to SOCKET mode; dt_shmem: It is a shared memory method, but it is only applicable to the windows environment
suspend : Whether to execute the JVM after the debugging client is established. 
address=5500: Listen for Socket connections on port 5500

 At this point, after startup. You can directly debug the services on the server remotely, which greatly shortens the time we spend troubleshooting and solving problems.

Guess you like

Origin blog.csdn.net/weixin_43005845/article/details/120195242