idea uses local code to remotely debug online running code---windows environment

Scenes:

   I read a method of remote code debugging in the book today, and it feels very good to verify it locally by myself! !

 

Windows environment:

Start the test jar package: platform-multiappcenter-base-app-1.0.0-SNAPSHOT.jar

Test tools: postman, idea

The port of the application service is: 19001

Start command:

java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9093 -jar platform-multiappcenter-base-app-1.0.0-SNAPSHOT.jar

illustrate:

transport
Specifies the communication protocol between the running debugged application and the debugger, with the following optional values:
  1. dt_socket: use socket connection (commonly used)
  2. dt_shmem : use shared memory connection, limited support, only supports windows platform
server
    Specifies whether the current application is used as a debugging server or a client. The default value is n (client).
If you want to use the current application as the debugged application, set the value to y ; if you want to use the current application as the client and the initiator of debugging, set the value to n .
suspend
  In most cases, this value should be n, that is, there is no need to block waiting for a connection (commonly used) . A possible application scenario for y is that your program starts
There is a fault at the time, in order to debug, you must wait until the debugger connects and then start the program
address
The externally exposed port defaults to 8000.  This port cannot be the same port as the project, and it is not occupied and open to the outside world.

 configuration in idea

edit configration 

 

Note: The host configured here is the ip where your test application is located, and the port is the port written in address in the startup command.

 DEBUG startup in idea

Request interface test:

 

It was found that the breakpoint was successfully entered, and the test was successful in the windows environment! ! ! !

 

Guess you like

Origin blog.csdn.net/qq_38423256/article/details/129023560