服务器远程远程Debug

服务器远程远程Debug

1. 在服务器上将启动参数修改为

java -Djavax.net.debug=ssl -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888 -jar springboot-1.0.jar

服务端远程Debug模式已经开启,端口号为8888.

2. 配置IDEA

点击Edit Configuration按钮,添加remote。


image-20210709215151650.png

填写项目名称、地址和端口号,并选取本地的模块。


image-20210709220629923.png

ok!完成配置。
此时,点击Debug按钮,即可进行远程调试。控制台输出
Connected to the target VM, address: '', transport: 'socket'

3. 可能遇到问题

如果遇到连接超时的情况,可能是服务器防火墙的问题。关闭防火墙或者放行对应端口即可。

#停止firewall
systemctl stop firewalld.service
#禁止firewall开机启动
systemctl disable firewalld.service
#添加端口放行
firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)
firewall-cmd --zone=public --add-port=1000-2000/tcp --permanent 
#重新载入
firewall-cmd --reload
#查看
firewall-cmd --zone=public --query-port=80/tcp
#删除
firewall-cmd --zone=public --remove-port=80/tcp --permanent

你可能感兴趣的:(服务器远程远程Debug)