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" 能夠斷定你的端口是否正常監聽
而後在你的程序中打斷點 調用請求就能夠進行遠程調試了