Using Eclipse for remote debugging "Go"

Source: Internet
Author: User

  Today decided to do something meaningful, write an illustrated blog, why should be illustrated? Because a lot of things may be said in words do not understand, from a previous article I published can be seen,http://blog.csdn.net/sunyujia/archive/2008/03/23/2211109.aspx  My friends after the ordinary reaction after reading feel unintelligible, may be I write too simple, the following step into the topic.         What is remote debugging, which is to debug a Web application on a B machine using Eclipse single-step tracking on a machine, of course, debugging a web app on a machine is no problem, 90% I am debugging the Web application of the machine, the significance of remote debugging I think I have to say, everyone will think of its benefits, you can debug the local application on the non-local test environment, this is a wonderful thing, so I don't say it's good, then local debugging, I like the local debugging also use the following methods to be introduced, why not myeclipse,wtp,tomcatplugin and so on.           below I explain the pitfalls of launching web Apps in Eclipse: I'm very fond of using myeclipse to do Web deployment, But I do not like to use MyEclipse to start Tomcat, of course wtp,tomcatplugin and so do not like, the advantage of using MyEclipse to do deployment is very flexible, not only can be deployed to the Web application inside can also be arbitrarily deployed to a specified path. However, if you use MyEclipse to start Tomcat, you have the following issues:         a. Card, which is slower, especially when launching multiple applications simultaneously .          B. If there are more breakpoints, such as more than 100, you must disable or simply delete each breakpoint that you do not need to use, that is, when the Web application starts, it determines whether it is debug mode or run mode. The middle cannot be switched. C. Once eclipse is dead, the Web application is broken. D. For the program relative path, the class loading path is completely different from the formal operation of the system (depending on the specific plug-in, each plug-in deployment method is not the same), and the Web application to run independently of the relative path and the class loading environment, of course, skilled veteran can easily fix, but the current domestic situationSee, a lot of beginners are still very distressed on this issue. E. Incidentally, regardless of this topic, the Eclipse Console does not fully emulate the CMD console, and some flow operations can be problematic. For example: Pushbackinputstream What are the benefits of using remote debugging for local debugging? a.        running speed is better. You can use the Eclipse Connection Web application to do debugging during the b.        run, you can disconnect when debugging is complete, and you can reconnect when you need to debug. The disabling of breakpoints may rarely be useful because it is free to switch between debug mode and run mode. The C.       web application runs independently, without worrying that eclipse will be dead and out of the game. d.        from development to on-line operation, the environment can always be consistent. Said a long time, no use of people may still do not understand, it's OK, you can read the following, and then back to look at the above. Let me give you a small example of how to debug remotely. Environment: Tomcat,eclipse, do not need any plugins for remote debugging. Of course, you can use MyEclipse to deploy Web applications to Tomcat, note that only deployment, in general, using remote debugging does not need to configure the MyEclipse Web server, MyEclipse here only a copy file role, Fortunately now myeclipse can specify the directory copy. That is, the custom location in the Deployment dialog box, where we recommend a copy file of a small plug-in, with this plugin will not need to myeclipse deployment. Filesync plugin for eclipse http://andrei.gmxhome.de/filesync/index.html  The author of this plugin also wrote a lot of other useful plug-ins, you can see by the way.         This example of the source code is very simple: JSP source code as follows Index.jsp<%com.syj.test.debugtest.test (" Sunyujia test ");%>hello RemotE Debug Make a breakpoint in the test method of the Debugtest class to test   Follow the steps below 1.     deploy the Web app to the WebApp directory of Tomcat 2.      Modify the Tomcat/bin/startup.bat file, preceded by the following code set Catalina_opts=-server-xdebug-xnoagent-djava.compiler =none-xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 Note that the above command must be written in the middle of a line can not have a newline,-before the space-after the non-space, due to different display resolution, The article may have a line break when it is displayed. More Web server remote debugging parameters can be found in http://blog.csdn.net/sunyujia/archive/2008/03/23/2211109.aspx3. You must first start Tomcat boot Tomcat/bin/startup.bat parameter 4. Set Breakpoint 5 in the Com.syj.test.DebugTest.test method. Configure debug in Eclipse and click the Debug button when the configuration is complete. 6. Open the browser to access the Web App deployed in step 1th, Access INDEX.JSP7. When the browser accesses the index.jsp, the program is intercepted by a breakpoint because of the call to Com.syj.test.DebugTest.test and by setting breakpoints in the test method, 8. Do not need to debug when the click Disconnect, need to debug when you click Debug, very convenient, when the debugging process occurs when referencing non-project source code (such as tracking into tomcat inside or spring,hibernate inside), will be prompted to find the source code, Click the corresponding prompt button (then the editor area there is only one button, so we do not ask which button) can add the source code to continue debugging, or before the configuration of debug before the need to add the source code, in the Source tab, Because the specific basic debugging knowledge is not within the scope of this topic, it is not too much introduction. The remote debugging is introduced here. Hit so many words or more hard, reproduced please indicate the source, thank you!   transferred from: http://blog.csdn.net/sunyujia/article/details/2614614

Using Eclipse for remote debugging "Go"

Related Article

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.