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类型的项目的远程调试功能.所谓的远程调试就是服务端程序运行在一台远程服务器上,我们可以在本地服务端的代码(前提是本地的代码必须 ...
随机推荐
- Hazelcast与MongoDB集成
Hazelcast与MongoDB集成 作者:chszs,未经博主同意不得转载.经许可的转载需注明作者和博客主页:http://blog.csdn.net/chszs 一.Hazelcast与Mong ...
- ffmpeg H264 编解码配置
ffmpeg H264编解码前面有文章介绍下,本文主要介绍一些参数配置. 编码: int InitEncoderCodec( int iWidth, int iHeight) { AVCodec * ...
- 获取EF查询的SQL语句
在EF编程中我们能够通过lamda表达式能够进行查询数据.获取到IQueryable<T>结果,我们要想知道详细的SQL语句是什么须要使用ObjectQuery<T>进行处理 ...
- C#基础关键字
1:override & new public class A { public virtual void Test() { Console.WriteLine("A Test()& ...
- man gitworkflows
gitworkflows(7) Manual Page NAME gitworkflows - An overview of recommended workflows with Git SYNOPS ...
- RESTful API 设计原则
http://www.ruanyifeng.com/blog/2014/05/restful_api.html http://www.ruanyifeng.com/blog/2011/09/restf ...
- bzoj1458 士兵占据
1458: 士兵占据 Time Limit: 10 Sec Memory Limit: 64 MB Submit: 685 Solved: 398 [Submit][Status][id=1458 ...
- EasyDarwin开源流媒体服务器性能优化之Work-stealing优化方案
本文转自EasyDarwin开源团队成员Alex的博客:http://blog.csdn.net/cai6811376/article/details/52400226 EasyDarwin团队的Ba ...
- select监听多个client -- linux函数
使用select函数能够以非堵塞的方式和多个socket通信.程序仅仅是演示select函数的使用,功能很easy,即使某个连接关闭以后也不会改动当前连接数.连接数达到最大值后会终止程序. 1. 程序 ...
- Struts2中properties