欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

yum 安装的tomcat 如何 IDEA 远程调试

程序员文章站 2022-04-24 08:00:11
开启idea的tomcat 远程调试,需要connect 1099端口,也就是开启JMX功能。 我是centos yum功能重度依赖者,所以tomcat 肯定也是yum 安装,但默认没有开启这个端口。 于是需要开启这个端口,网上的教程千篇一律,要求添加以下修改 catalina.sh 。然后在通过 ......

开启idea的tomcat 远程调试,需要connect 1099端口,也就是开启JMX功能。

我是centos yum功能重度依赖者,所以tomcat 肯定也是yum 安装,但默认没有开启这个端口。

于是需要开启这个端口,网上的教程千篇一律,要求添加以下修改 catalina.sh 。然后在通过 ./catalina.sh & 来启动。

 

export CATALINA_OPTS="-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=1099 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Djava.rmi.server.hostname=172.16.0.105"

export JAVA_OPTS="-Dcom.sun.management.jmxremote=
-Dcom.sun.management.jmxremote.port=1099
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"

  

我肯定不能接受啊, 这样就破坏了tomcat start 这样具有设计美学的系统命令。

于是查找tomcat的配置文件,发现tomcat.conf 其实就是shell形式的扩展,秒懂,于是在 

/usr/share/tomcat/conf/conf.d

目录,新建 jmx.conf  ,黏上 上面开启jmx的代码。输入

tomcat stop
tomcat start

在重新 run idea的tomcat ,顺利发布代码。

 

 

最后安利下 巴里云 的 rds mysql ,用完rds mysql,浑身舒爽,和我一样,轻松做mysql大神。