当前位置:网站首页>远程调试 idea配置remote debug、在远程服务器的程序中,添加JVM启动参数-Xdebug
远程调试 idea配置remote debug、在远程服务器的程序中,添加JVM启动参数-Xdebug
2022-07-27 20:45:00 【但行益事莫问前程】
前言
在本地开发的程序运行在服务器上报错且缺少日志信息甚至没有错误日志时,需要通过远程调试来调试服务器上的程序
1. idea配置remote debug
1.1 在服务器的程序中,添加JVM启动参数
在启动程序的脚本中,即java -jar命令后,添加支持远程调试的参数(默认选择5005端口,为避免端口冲突,可选用其他不常用端口)
-Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n
参数含义:
-XDebug 启用远程调试
-Xrunjdwp 加载JDWP的JPDA参考执行实例
transport 用于在调试程序和VM使用的进程之间通讯
dt_socket socket传输
server=y/n VM是否需要作为调试服务器执行
address=5005 调试服务器监听的端口号
suspend=y/n 是否在调试客户端建立连接之后启动VM
如:
1.2 idea连接远程服务器,进行远程调试
点击Add Configuration后选择Remote
设置远程服务器的Ip和远程调试的端口
在本地代码中添加断点后,即可调试远程服务器上代码

注:
若远程服务器和本地之间防火墙未打开,则无法进行远程调试,可通过telnet ip 端口命令测试通信
2. 远程调试原理
Java程序统一以字节码的形式在JVM中运行,只要本地代码和远程服务器上的类文件相同,两个JVM通过调试协议进行通信,本地的源码就可以连接到远程服务器上的JVM,进而执行远程调试
边栏推荐
猜你喜欢

习题 --- BFS

Vulnhub range double trouble

Learn more about xxE injection

The wechat installation package has expanded 575 times in 11 years, and the up owner: "98% of the documents are garbage"; Apple App store was exposed to a large number of pornographic apps; Four techn

【信号处理】基于高阶统计量特征的通信系统中微弱信号检测附matlab代码
Blood spitting finishing nanny level series tutorial - playing Fiddler bag capturing tutorial (5) - detailed explanation of fiddler monitoring panel
![[signal processing] weak signal detection in communication system based on the characteristics of high-order statistics with matlab code](/img/a7/8f0d929457d285adc8020c7f5d33ea.png)
[signal processing] weak signal detection in communication system based on the characteristics of high-order statistics with matlab code

The principle and demonstration of service path lifting without quotation marks

Introduction to the paper | distributed graph simulation

Www 2019 | Han: heterograph attention network
随机推荐
毕设-基于SSM高校后勤管理系统
Preliminary understanding of Panda3D audio and advanced interactive components
简单实用的数据可视化案例
AWS DynamoDB运用技巧
Deploy dolphin scheduler high availability cluster based on rainbow
CSDN dedicated killer technology -- Google browser plug-in
他山之石 | 蚂蚁超大规模知识图谱构建及应用
[C language] simulate and implement string functions (Part 1)
containerd ctr运行ansible容器执行ansible-playbook任务完整命令
并发和并行有什么区别?
2022/7/26
[soft test software evaluator] 2014 comprehensive knowledge over the years
QT with OpenGL(Shadow Mapping)(平行光篇)
Desai wisdom number - other charts (parallel coordinate chart): family's willingness to allocate assets in the future
Basic SQL DQL
怎么使用C# Winform实现复制文件显示进度
台积电3nm细节曝光:晶体管密度高达2.5亿个/mm²,性能及能效大幅提升
疫情之下,台积电一季度增长超预期,7nm占比35%!二季度或创新高
How do I shut down oracle?
China Internet Security Report 2021: API threat soared by more than 200%, and the security risk of software supply chain increased