Tomcat using myeclipse remote debugging Java code Configuration

Source: Internet
Author: User

Tomcat uses myeclipse remote debugging Java code to summarize the following:
When you do remote debugging, the configuration under Windows and non-Windows systems is different in Tomcat, as follows:


The first step, configure Tomcat
One, in the Windows system:
Open the file Catalina.bat under%cataline_home%/bin, and add the following line:
Set Catalina_opts=-server-xdebug-xnoagent-djava.compiler=none-xrunjdwp:transport=dt_socket,server=y,suspend=n, Address= 8000


Where address=8000 is the port number that is not being used. There are two ways to connect, for Dt_shmem and Dt_socket, respectively, for native debugging and remote debugging.


Second, in non-Windows systems:
You also need to change the last line in the% cataline_home%/bin/startup.sh exec "$PRGDIR"/"$EXECUTABLE" start "[email protected]" to start in Jpda start. Since the default port is 8000, if the port of 8000 is already in use, it needs to be set in the catalina.sh file: jpda_address=8000.
Enter the command startup.sh or catalina.sh JPDA start to launch Tomcat.


Step Two, configure Eclipse

Select Run debug in Eclipse, and in the pop-up dialog, right-click Remote Java application to create a new debug entry, as follows:

Enter the name of the remote debugging in the "Name" input box, select the project you want to debug in project, enter the IP that requires the remote debugging project in "Host", which is the IP where Tomcat is located, enter the port number set in "port", such as the 8000 set above, Then tick "Allow termination of remote VM" and click "Apply".
After setting up, you can start debugging, about a few steps:
1. Start tomcat (remote), such as the console output "Listening for transport Dt_socket at address:8000", which indicates the success of the setup in Tomcat;
2, set the breakpoint in the machine;
3, enter the interface, select the items to debug, click "Debug" can be remote debugging;
4. Visit your test page to see the long-Lost debugging interface.


But each time doing this is annoying, rather than write a batch, such as the name of Tomcat Debug.bat, in this file to add the following lines:


CD%cataline_home%/bin
Set jpda_address=8000
Set Jpda_transport=dt_socket
Set Catalina_opts=-server-xdebug-xnoagent-djava.compiler=none-xrunjdwp:transport=dt_socket,server=y,suspend=n, address=8787
Startup


Save this script to the Tomcat/bin directory and then send a shortcut to the desktop, ou ~ ~ ~
This allows you to run Debug.bat when remote debugging is required, when you do not need remote debugging, or when you run the Startup.bat file


Tomcat using myeclipse remote debugging Java code Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.