国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > Tomcat > 正文

Java項(xiàng)目開啟遠(yuǎn)程調(diào)試的方法步驟(tomcat、springboot)

2024-09-06 19:00:51
字體:
供稿:網(wǎng)友

當(dāng)我們運(yùn)行一個(gè)項(xiàng)目的時(shí)候,一般都是在本地進(jìn)行debug。但是如果是一個(gè)分布式的微服務(wù),這時(shí)候我們選擇遠(yuǎn)程debug是我們開發(fā)的利器。

環(huán)境

apache-tomcat-8.5.16

Linux

如何啟用遠(yuǎn)程調(diào)試

tomcat開啟遠(yuǎn)程調(diào)試

方法

切換到你的tomcat的bin目錄/apache-tomcat-8.5.16/bin
下,執(zhí)行:

./catalina.sh jpda start 

執(zhí)行上面的命令就可以開啟遠(yuǎn)程debug了,如果想配置一些信息,比如端口號(hào)什么的,請(qǐng)參考下面的說明。

參數(shù)說明

#  JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start"#          command is executed. The default is "dt_socket".##  JPDA_ADDRESS  (Optional) Java runtime options used when the "jpda start"#          command is executed. The default is localhost:8000.##  JPDA_SUSPEND  (Optional) Java runtime options used when the "jpda start"#          command is executed. Specifies whether JVM should suspend#          execution immediately after startup. Default is "n".##  JPDA_OPTS    (Optional) Java runtime options used when the "jpda start"#          command is executed. If used, JPDA_TRANSPORT, JPDA_ADDRESS,#          and JPDA_SUSPEND are ignored. Thus, all required jpda#          options MUST be specified. The default is:##          -agentlib:jdwp=transport=$JPDA_TRANSPORT,#            address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND

操作說明

所以如果想修改配置,則如下操作:

在catalina.sh中進(jìn)行配置:

JPDA_TRANSPORT=dt_socket JPDA_ADDRESS=5005 JPAD_SUSPEND=n 

或者通過JPDA_OPTS進(jìn)行配置:

JPDA_OPTS='-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005'

springboot開啟遠(yuǎn)程調(diào)試

遠(yuǎn)程調(diào)試maven設(shè)置

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>

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"

jar 命令開啟遠(yuǎn)程調(diào)試

在執(zhí)行jar的時(shí)候,添加上參數(shù)。如下:

java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar demo.jar
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 望都县| 宾川县| 德庆县| 会同县| 修文县| 津市市| 广昌县| 神木县| 桃江县| 焦作市| 全椒县| 永修县| 库伦旗| 巴林左旗| 怀宁县| 铁岭县| 丹凤县| 厦门市| 巴林右旗| 沂水县| 临洮县| 武川县| 黑龙江省| 建平县| 阿瓦提县| 开平市| 罗甸县| 博客| 定西市| 寻甸| 虹口区| 丰镇市| 达孜县| 灌南县| 西乌珠穆沁旗| 定结县| 渭南市| 德钦县| 随州市| 外汇| 崇礼县|