Skip to content

Attach Remote Application

Start

Download debug-tools-boot.jar

text
https://download.debug-tools.cc/debug-tools-boot.jar
sh
git clone https://github.com/future0923/debug-tools.git
cd debug-tools
mvn clean install -T 2C -Dmaven.test.skip=true
# dist dir
# debug-tools-boot.jar remote agent jar
text
https://github.com/future0923/debug-tools/releases
text
https://gitee.com/future94/debug-tools/releases
The manual build encountered a packaging failure problem

The current Maven packaging requires a Java 1.8 build.

Attach

Run the debug-tools-tools.jar jar.

shell
java -jar debug-tools-tools.jar

The output is as follows:

text
[INFO] debug-tools-boot version: 3.0.0
[INFO] Found existing java process, please choose one and input the serial number of the process, eg : 1. Then hit ENTER.
* [1]: 8317 /home/work/debug-tools-test-application-3.0.0.jar
  [2]: 13167 /home/work/debug-tools-boot.jar

Enter the serial number of the attached application and press Enter, it will output Success Failure and print tcpPort and httpPort information.

text
[INFO] Try to attach process 8317
[INFO] Attach process 8317 success. tcp port 12345, http port 22222.

Config

The parameter description can be viewed through java -jar debug-tools-boot.jar -h.

text
usage: debug-tools
 -hp,--http-port <arg>   target application server http port
                         default get available port.
 -tp,--tcp-port <arg>    target application server tcp port
                         default get available port.
ParameterDescriptionDefault
-hp,--http-portSpecify the HTTP portincrement from 22222 to find available ports
-tp,--tcp-portSpecify the TCP portincrement from 12345 to find available ports

Connect

Click the toolbar on the right side of Idea to wake up the DebugTools window, and click Connect to fill in the remote address.

connect_tools_window

Enter host, tcpPort and httpPort, and click the Save & Connent button to connect the remote application.

connect_input.png

After successfully attaching the application, DebugTools will display the attachment status.

  • R: indicates that the application is a remote application, and L indicates that it is a local application.
  • Connected: the application has been successfully attached and connected to the service.
  • i.g.f.d.t.t.a.DebugToolsTestApplication: the application name.
    • Specified application name if the application name is specified during attachment.
    • If the application name is not specified, the spring.application.name configuration item is used if it is a Spring application.
    • If not specified, the Main-Class in the jar at startup is used.
    • If not found, the sun.java.command in the startup command is used.

remote_attach_status

Use

After the connection is successful, you can wake up the debug panel to make a shortcut call to a remote method and view results, or you can use groovy console.

Advanced

If the attached app and Idea enable the remote Debug, DebugTools can not only quickly call remote methods, but also perform remote Debug breakpoint debugging.