Intellij IDEA 远程Debug Tomcat应用

 pre:

关闭tomcat应用

进入/bin目录打开catalina.sh:

[root@iZwz947 ~]# cd /
[root@iZwz947 /]# cd home/tmc_test/apache-tomcat-test2
[root@iZwz947 apache-tomcat-test2]# cd bin/
[root@iZwz947 bin]# vim catalina.sh 

过程可能会报错:(键入回车强制编辑即可)

E325: ATTENTION
Found a swap file by the name ".catalina.sh.swp"
          owned by: tmc_test   dated: Wed Jan 24 14:40:18 2018
         file name: ~tmc/apache-tomcat-7.0.72/bin/catalina.sh
          modified: YES
         user name: tmc   host name: iZwz9aehttqhrnjk0xy4gqZ
        process ID: 8390
While opening file "catalina.sh"
             dated: Thu Aug  2 17:42:12 2018
      NEWER than swap file!

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r catalina.sh"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".catalina.sh.swp"
    to avoid this message.

Swap file ".catalina.sh.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:

添加配置,其中address端口值可自定义:

键入i,添加如下配置,再键入:,输入wq!,强制保存退出。

CATALINA_OPTS="$CATALINA_OPTS -Xdebug  -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=n"

 

配置IDEA Remote: 

键入远程服务器地址Host,以及上面配置的端口号9999至Port,可手动指定模块路径(即你的项目应用),最后点击OK

 tip:确保远程部署Tomcat代码与本地代码版本一致,点击Debug(快捷键Ctrl+F5),本地设置断点,访问远程应用时,便会进入断点

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值