springboot开启远程调试
The run goal forks a process for the boot application. It is possible to specify jvm arguments to that forked process. The following configuration suspend the process until a debugger has joined on port 5005
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.1.12.RELEASE</version>
<configuration>
<jvmArguments>
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
</jvmArguments>
</configuration>
...
</plugin>
...
</plugins>
...
</build>
...
</project>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
These arguments can be specified on the command line as well, make sure to wrap that properly, that is:
mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
- 1
jar 命令开启远程调试
在执行jar的时候,添加上参数。如下:
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar demo.jar
- 1
如果想深入了解Java调试,那么去看一下这个吧。深入Java调试体系
问题
如果出现Connection refused。
首先检查一下端口8000的使用情况:
use:~/tomcat/logs # netstat -an|grep 8000
cp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN
- 1
- 2
可见当前16808端口服务被绑定了回环地址,外部无法访问。即本地调试。
办法:
修改catalina.sh中一个参数。
if [ -z "$JPDA_TRANSPORT" ]; then
JPDA_TRANSPORT="dt_socket"
fi
if [ -z "$JPDA_ADDRESS" ]; then
JPDA_ADDRESS="0.0.0.0:8000"
fi
if [ -z "$JPDA_SUSPEND" ]; then
JPDA_SUSPEND="n"
fi
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
对JPDA_ADDRESS="localhost:8000" 把默认值(localhost:8000)改成0.0.0.0:8000。默认是本地ip调试也就是无法远程调试,0.0.0.0表示所有ip地址都能调试。
远程连上后再看端口情况:
root@VM-198-217-ubuntu:/opt/apache-tomcat-8.5.16/bin# netstat -an | grep 8000
tcp 0 0 10.133.198.217:8000 60.177.99.27:49998 ESTABLISHED
- 1
- 2
断开后是这样的:
root@VM-198-217-ubuntu:/opt/apache-tomcat-8.5.16/bin# netstat -an | grep 8000
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN
tcp 0 0 10.133.198.217:8000 60.177.99.27:49998 TIME_WAIT
- 1
- 2
- 3
idea连接远程端口进行远程debug
我已经在服务器上开启了远程调试,idea连接的步骤,直接上图。
edit configurations
远程调试配置
参数配置
将红框内的地址和端口号改成自己的。
启动远程调试
成功界面
请求一下试试
转自:https://blog.csdn.net/wsyw126/article/details/74853680
springboot开启远程调试的更多相关文章
- Java项目开启远程调试(tomcat、springboot)
当我们运行一个项目的时候,一般都是在本地进行debug.但是如果是一个分布式的微服务,这时候我们选择远程debug是我们开发的利器. 环境apache-tomcat-8.5.16 Linux 如何启用 ...
- springboot项目使用idea开启远程调试
远程调试是调试服务器的有效手段,远程服务器运行的应用可以在本地代码中打断点调试,能让开发人员准确定位服务器上的问题. 一.开启远程调试前提:本地代码与服务器代码一致, 二.开启远程调试步骤 1.开发工 ...
- tomcat如何正确的开启远程调试功能
在日常开发中,有时需要对远程服务器上的应用进行远程调试,对于tomcat,要进行远程调试其实很简单,只需要在启动tomcat时开启jpda服务即可. 什么是JPDA呢? JPDA(JavaPlatfo ...
- tomcat开启远程调试
tomcat开启远程调试模式: 需要在启动脚本中的 JAVA_OPTS='-server -Xms1024m -Xmx1024m -Xmn384m -Xss256k -XX:PermSize=128m ...
- tomcat如何正确的开启远程调试功能(转)
转自:http://blog.csdn.net/mhmyqn/article/details/49209541 版权声明:本文为博主原创文章,未经博主允许不得转载. 在日常开发中,有时需要对远程服务器 ...
- 【IDEA】【SpringBoot】基于idea对springboot程序远程调试
一.开启远程调试前提:本地代码与服务器代码一致(实测:不关键的代码稍微有点不一样好像也不会有多大问题). 二.开启远程调试步骤 1.开发工具配置 idea端打开Edit configurations, ...
- 惊呆了!Spring Boot 还能开启远程调试?
持续原创输出,点击上方蓝字关注我 目录 前言 什么是远程调试? 为什么要远程调试? 什么是JPDA? 如何开启调试? transport server suspend address onthrow ...
- eclipse 在weblogic部署的工程项目开启远程调试remote config eclipse远程调试配置
确认你的工程在weblogic中跑的起来,然后再结合eclipse debug配置+java debug运行模式搞个调试. 工程能跑起来没问题后,先在eclipse中,点击debug图标 然后点击De ...
- Intellij IDEA基于Springboot的远程调试
简介 本篇博客介绍一下在Intellij IDEA下对Springboot类型的项目的远程调试功能.所谓的远程调试就是服务端程序运行在一台远程服务器上,我们可以在本地服务端的代码(前提是本地的代码必须 ...
随机推荐
- python_获得列表中重复的项的索引
a = ['b','a', 'b', 'c', 'a', 'c','d'] b=[] f=[] for i in a: c=[] for item in enumerate(a): if item[1 ...
- jquery 的父子节点
1.一级父节点 parent() n级父节点 parents(???). 2.一级子节点 children() n级子节点 用find(???)
- wdatepicker ie8等问题
官方文档:http://www.my97.net/demo/resource/2.4.asp 以下内容为使用中遇到的问题,具体该插件具有的方法请自行查阅官方文档. 1.当触发wdatepicker事件 ...
- was系统错误日志大量出现标识符缺失
原创作品.出自 "深蓝的blog" 博客,深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/46909941 近日 ...
- Codeforces 569 B. Inventory
click here~~ **B. Inventory** time limit per test1 second memory limit per test256 megabytes inputst ...
- 项目部署到niginx title乱码问题
今天部署我react移动端项目到我的linux服务器的时候出现乱码问题 原来是我再配置niginxserver的时候没有指定charset,设置为utf-8,重启nginx服务器,大功告成
- 01 json方式封装通信接口
新建一个json_api.php<?php class Response{ /** *按json方式输出通信 *@param integet $code 状态码 *@param string $ ...
- 解决Android Studio下Element layer-list must be declared问题
近期将一个项目从Eclipse转到Android Studio. 项目中使用了环信demo中的一些xml资源,转换后发现color资源目录下诸如layer-list或者shape等标签报Element ...
- codevs1032
题目地址:http://codevs.cn/problem/1032/ 分析: 题目数据有错.这题过不了才正常. 我调了非常久可是就是有两个点过不去.于是我把数据下了下来,找到WA的第五个点和第七个点 ...
- Android: 亲測解决模拟器启动慢的问题
1.首先在相应的sdk manager里面下载一个4.03以上的api. 这里我选择的是4.2.2 (api17) 2.选择里面的" Intel Hardware Accelerated E ...