The program is such a magical thing, sometimes one of your projects, on the local run is still good, but when you put the goods on the server, the same condition is the result is different. So Gray often want to see the program in the remote runtime state, want to let the program run remotely, but also in the local interrupt point to follow, this is used to remotely debug tomcat with Eclipse. I remember studying a long time ago, how did not succeed. It's finally OK recently.
First, commissioning preparation
First there must be a tomcat on the remote server with a local eclipse, and a program that is already deployed on remote Tomcat and the source code is on local eclipse. Of course, if the wood has a remote server to use their own native when the remote server tried also ok ha.
Ii. Configuring Tomcat
1, if the remote server is a Windows NT environment, then create a debug.bat file under%cataline_home%/bin, paste the following content:
Set jpda_address=8888
Set Jpda_transport=dt_socket
Set Catalina_opts=-server-xdebug-xnoagent-djava.compiler=none-xrunjdwp:transport=dt_socket,server=y,suspend=n, address=8888
Startup
Two of these 8787 are remote ports to enable, and of course any unused ports are available. There are two ways to connect, for Dt_shmem and Dt_socket, respectively, for native debugging and remote debugging.
2, if the remote server is Linux/unix environment, edit the%cataline_home%/bin/startup.sh file, find the last line, will
Exec "$PRGDIR"/"$EXECUTABLE" start "[email protected]"
Switch
Exec "$PRGDIR"/"$EXECUTABLE" jpda start "[Email protected]"
The default remote debugging port is 8000, if it is occupied, edit the%cataline_home%/bin/catalina.sh file to
jpda_address= "8000"
Switch
jpda_address= "8888"
3. Run Debug.bat under Windows startup.sh start Tomcat under Linux.
If it appears in the startup log
Listening for transport Dt_socket at address:8888
Indicates that the remote debugging port is listening successfully.
Third, configure Eclipse
Right-click on the project you want to debug, select Debug Mode --Debug configuration
Open the Configuration interface and select a remote Java application to create a new remote debugging
The IP address is the remote server IP address, and the port is the remote debug listening port of Tomcat that was just configured. Configure the post-point application , debug .
You can then open the debug interface to see the status of the thread, or you can disconnect debugging at any time.
MyEclipse Remote Debugging Tomcat