linux下tomcat eclipse开启远程debug

I assume that you have already deployed your application. Now you want to debug it remotely. For that first you need to start Apache tomcat in debug mode. To do that execute the following commands java

export JPDA_TRANSPORT=dt_socket linux

export JPDA_ADDRESS=8090
web

./catalina.sh jpda start tomcat

JPDA_TRANSPORT=dt_socket sets debugging through socket layer. 服务器

JPDA_ADDRESS=8090 sets the debug port as 8090. app

./catlina.sh jpda start is the actual command thet will start tomcat and with debug options.
eclipse

Now you need to open port 8090 from the firewall rules. Assuming your iptables files is in/etc/sysconfig/iptables add the following entry to it socket

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 8090 -j ACCEPT tcp

Save the file and restart the firewall by the following command url

/etc/rc.d/init.d/iptables restart.

Now in Eclipse go to debug configurations and create a new configuration for remote java application. Fill in the connection properties i.e. host and port. Also select the project that contains the source for the remote java application.

After entering the information, click apply and run. Now open the web application using the url with regular port 8080 and you should be able to debug it.

在服务器调试正确以后:

回到客户端设置eclipse或者是myeclipse

菜单:run -- debug configurations -- Remote Java Application 新建一个远程连接

工程选择你本地的工程【服务器上存在这个工程】

ip:服务器IP地址

port :端口 默认是8000 的 若是有修改就写你修改的值

    在linux下使用netstat -anp|grep "8000" 能够断定你的端口是否正常监听

而后在你的程序中打断点  调用请求就能够进行远程调试了

相关文章
相关标签/搜索