进入到idea的tomcat的run/debug配置,新建个remote tomcat,然后填写相关信息,如上图(注意远程调试端口)。

再选择Startup/Connection,如下图所示:

到此,idea已经配置好了,接下来将图上说的那段拷贝到远程的tomcat的catalina.sh文件中。

登陆到远程服务器,进入到tomcat的bin目录下,vi打开catalina.sh文件:

找到第一个JAVA_OPTS,添加:

JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,address=54531,suspend=n,server=y"或者

CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=54531,suspend=n,server=y"
填一个即可。

重启下tomcat。

netstat -an | grep 55555,查看下55555端口是否打开,打开说民设置成功。

这样既可以使用idea远程调试了。

另外最好的方式就是不要去改动默认的sh文件,那就是自己写的debug.sh。

将startup.sh拷贝一份,改名为debug.sh.

打开,内容如下:

#!/bin/sh

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# -----------------------------------------------------------------------------
# Start Script for the CATALINA Server
# -----------------------------------------------------------------------------

# Better OS/400 detection: see Bugzilla 31132
os400=false
case "`uname`" in
OS400*) os400=true;;
esac

# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ] ; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done

PRGDIR=`dirname "$PRG"`
EXECUTABLE=catalina.sh

# Check that target executable exists
if $os400; then
  # -x will Only work on the os400 if the files are:
  # 1. owned by the user
  # 2. owned by the PRIMARY group of the user
  # this will not work if the user belongs in secondary groups
  eval
else
  if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
    echo "Cannot find $PRGDIR/$EXECUTABLE"
    echo "The file is absent or does not have execute permission"
    echo "This file is needed to run this program"
    exit 1
  fi
fi
export CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=55555,suspend=n,server=y"

exec "$PRGDIR"/"$EXECUTABLE" start "$@"

增加红色部分即可。

root@×××:/usr/local/tomcat/bin# sh debug.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/lib/jdk/jre
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
root@×××:/usr/local/tomcat/bin# netstat -ano|grep 55555
tcp        0      0 0.0.0.0:55555           0.0.0.0:*               LISTEN      off (0.00/0/0)
root@×××:/usr/local/tomcat/bin#
如果按上面步骤执行后,看见设置的端口已经被监听,说明配置成功。

idea14远程调试linux下的tomcat的更多相关文章

  1. idea远程调试linux下的tomcat

    要远程调试代码,首先的保障本地的代码和远程tomcat的代码是同一份 首先在本地idea配置一个远程tomcat服务器 host就填写远程主机ip port填写访问的端口(不是调试端口) 然后在Sta ...

  2. 使用Windows上的Eclipse 远程调试 linux下的Tomcat

    1:修改Linux上Tomcat的catalina.sh,第一行添加declare -x CATALINA_OPTS="-Xdebug -Xrunjdwp:transport=dt_sock ...

  3. 转载:JProfiler远程监控LINUX上的Tomcat过程细讲

    来源于xuwanbest的博客   所谓"工欲善其事,必先利其器",好的工具确能起到事半工倍的作用.我用到的最多的就两个JConsole 和JProfiler .JConsole监 ...

  4. Linux下配置Tomcat服务器

    Linux下配置Tomcat服务器和Windows下其实差不多,可以去官网下载安装包释放或者在线下载,只是当时下载的windows.zip文件,现在下载.tar.gz格式的即可,下面使用命令行的方式安 ...

  5. Linux下部署tomcat

    在Linux系统下,重启Tomcat使用命令操作的! 首先,进入Tomcat下的bin目录 cd /usr/local/tomcat/bin 使用Tomcat关闭命令 ./shutdown.sh 查看 ...

  6. Linux下安装Tomcat服务器和部署Web应用

    一.上传Tomcat服务器

  7. linux下查看tomcat和jdk版本号

    linux下查看tomcat和jdk版本号的命令: 这个需要进入到bin目录下面 ,执行"./version.sh"命令 [root@hncsweb bin]# ./version ...

  8. 转】Linux下安装Tomcat服务器和部署Web应用

    原博文出自于: http://www.cnblogs.com/xdp-gacl/p/4097608.html 感谢! 一.上传Tomcat服务器

  9. jmeter测试本地myeclips调试状态下的tomcat程序死锁

    在myeclipse调试状态下的tomcat程序,用jmeter测试,居然发生死锁,调试两天无果,直接运行tomcat而不通过myeclipse,无死锁,真是又好气又好笑..

随机推荐

  1. easyui 生成tas方式

    1.采用<a>标签形式 <div id="tabs" style="width:100%;"> <ul> <li id ...

  2. ODB(C++ ORM)用Mingw的完整编译过程

    用mingw官方的GCC4.7.2编译libodb后,并用odb compiler对hello示例生成odb的"包裹"代码,编译链接总是不能通过,下面是编译example/hell ...

  3. eclipse maven创建web项目

    记录地址 jdk设置及文件包miss 实例下载地址 创建SSM整合项目 一.使用Eclipse中的maven插件创建web项目 1: 2: 3: 4: 5:maven web项目创建成功.(去掉ind ...

  4. 小记 vue 打包(build)需要注意的一些事

    记录 vue 项目打包的一些事情 首先声明项目都是由 vue-cli 生成; vue 项目从 dev 切换到 prod 时有很多地方需要注意; 首先是大家最需要注意的 ajax 切换环节 以前一开始用 ...

  5. [C++ 多线程] 学习前瞻

    1 多线程是什么? 1.1 多线程的概念? 说起多线程,那么就不得不说什么是线程,而说起线程,又不得不说什么是进程. 进程可以简单的理解为一个可以独立运行的程序单位,它是线程的集合,进程就是有一个或多 ...

  6. DP Codeforces Round #FF (Div. 1) A. DZY Loves Sequences

    题目传送门 /* DP:先用l,r数组记录前缀后缀上升长度,最大值会在三种情况中产生: 1. a[i-1] + 1 < a[i+1],可以改a[i],那么值为l[i-1] + r[i+1] + ...

  7. 题解报告:poj 3669 Meteor Shower(bfs)

    Description Bessie hears that an extraordinary meteor shower is coming; reports say that these meteo ...

  8. Linux系统下强制踢掉登录用户

    1,利用who命令,找出用户登录的终端代号 who root     pts/0        2017-03-14 22:30 (223.1.1.1) root     pts/1        2 ...

  9. 记一个java.lang.NoClassDefFoundError的问题

    如题,即找不到对应class,出现这个问题,很可能是文件路径配置错误,也可能是jar包丢失. 比如我今天遇到的问题,就是IDEA没有把mybatis的jar包复制到编译目录造成的.

  10. poj2502 Subway

    思路: 需要注意的地方:一条地铁线路并不一定和样例描述的那样是直的:同一条线路上的两个站点步行可能更快. 实现: #include <iostream> #include <cstd ...