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

export JPDA_TRANSPORT=dt_socket

export JPDA_ADDRESS=8090

./catalina.sh jpda start

JPDA_TRANSPORT=dt_socket sets debugging through socket layer.

JPDA_ADDRESS=8090 sets the debug port as 8090.

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

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

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

Save the file and restart the firewall by the following command

/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" 可以判定你的端口是否正常监听

然后在你的程序中打断点  调用请求就可以进行远程调试了


你可能感兴趣的:(linux下tomcat eclipse开启远程debug)