Integrate Tomcat remote debugging in eclipse 3.1
Some time ago, when debugging eclipse, a problem occurred. That is, when an eclipse 3.1 remoto application debug was added. The error message is that the remote VM connection attempt failed.
Remote debugging principles ~
Start the start. BAT file of Tomcat
Add a parameter to modify Catalina. BAT in Tomcat/bin.
% _ Execjava % java_opts % catalina_opts % debug_opts %-xdebug-xrunjdwp: Server = Y, transport = dt_socket, address = 8000, suspend = N-djava. endorsed. dirs = "% java_endorsed_dirs %"-classpath "% classpath %"-dcatalina. base = "% catalina_base %"-dcatalina. home = "% catalina_home %"-djava. io. tmpdir = "% catalina_tmpdir %" % mainclass % cmd_line_args % action %
There is an address = 8000 indicating the port number for debugging in the initate.
Start eclipse and add a remoto Java application in "-> debug". Enter the IP address of your application server in the host. Enter the debug port number set in tomcat in "Port ~ 8000 and then debug it directly.
Add several segments in the code ~ Then you can debug it.
------------------------------------------------------------
Set two environment variables before starting Tomcat
Cd % catalina_home %/bin
Set jpda_address = 8000
Set jpda_transport = dt_socket
Startup
The best way is to create a BAT file with the following content (assume that your catalina_home address is D:/tomcat-5.5.9 ):
Code
- Set jpda_address = 8000
- Set jpda_transport = dt_socket
- Cd d:/tomcat-5.5.9/bin
- Catalina JPDA start
In eclipse, select Run --> Debug. On the displayed page, select remote Java application on the left. Enter a project name in the Name field on the right and enter the name of the project to be remotely debugged. HOST: localhost Port: 8000 (these eclipse will automatically help you fill in)