In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
In the process of local development, Debug the code can debug the code logic line by line, which is convenient to prepare and troubleshoot. However, when the code is released online, if there is an exception in the process of running, it will be time-consuming to rely on the log to troubleshoot the problem, and it will often be unable to locate the problem quickly and accurately because of incomplete logs and other reasons, and this problem can be well solved by remote Debug of JAVA code.
This blog post focuses on configuring remote Debug for JAVA code in IDEA, as well as matters needing attention.
We know that the Java program runs on the Java virtual machine in the form of bytecode, because they are bytecode files, so as long as the local code is the same as the class file on the remote server, the two JVM can communicate through the debugging protocol. It should be noted here that the server being debugged needs to be in debug mode, and the server-side code must be consistent with the local code, otherwise the breakpoint cannot be entered.
Remote Debug of JAVA code in IDEA requires two steps of preparation.
First, the JAVA code on the remote server turns on debugging mode.
Project type: Spring Boot project
JDK version: 1.8.0,131
Project launch command: java-jar-Dspring.profiles.active=development-Xms1024m-Xmx1024m-Xmn600m-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=4001-XX:-OmitStackTraceInFastThrow-XX:+UseG1GC-XX:G1ReservePercent=25-XX:+HeapDumpOnOutOfMemoryError-XX:HeapDumpPath=log-XX:+PrintGCDetails-XX:+PrintGCDateStamps-Xloggc:log/gc.log smart-building.jar
The configuration for enabling remote debug is:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=4001
Parameter description:
Jdwp:java debug wire protocol
Transport=dt_socket: communicate with socket protocol
Server=y: open the debugging server
Address=4001: communication port is 4001
2. Parameter configuration in IDEA 1. Open the remote Debug parameter configuration window
two。 Configure Debug parameters
Host represents the IP address of the remote server.
Port represents the port for Debug communication with the remote server.
Command Line indicates the startup parameter, indicating that remote Debug is enabled.
Use module classpath represents the local code path corresponding to the remote service.
3. Click the Debug icon to start Debug
When this line of log is output in the IDEA console, the local IDEA is connected to the Debug port of the remote service, and then you can start the remote code Debug just like debugging the local code.
3. Note when remote Debug is enabled, any operation that can reach the breakpoint will cause the business to block to the breakpoint, thus affecting the normal execution of the business process, so it is best to choose remote Debug debugging when there are no user actions. During remote Debug debugging, the completion of debugging will not result in the termination of the remote business process, and the online business will continue to execute.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.