Remote project debugging and project debugging

Source: Internet
Author: User

Remote project debugging and project debugging
Background

Local debugging is very common during Java project development, but some situations cannot be achieved by local debugging, such as Maven project. In fact, remote debugging is required at this time. No matter whether the development tool is Eclipse, Netbeans, or IDEA, remote debugging can be implemented. Of course, this is also inseparable from the support of the application server.
Description
List the instances of two application servers. One is resin (Version 4.0, which can be configured in previous versions) server, and the other is tomcat server.
Resin server
The core configuration file of the resin server is resin. xml. For remote debugging, you must go to resin. configure the sub-tag of the <server-default> label <jvm-arg> in the xml file. The specific configuration is as follows:
<jvm-arg>-Xnoagent</jvm-arg><jvm-arg>-Xdebug</jvm-arg>                      <jvm-arg>-Djava.compliler=NONE</jvm-arg><jvm-arg>-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8082</jvm-arg>
Note the address port number, which is the port listening to jvm. You need to enter this port number for remote debugging. Restart resin after the configuration is complete. You need to configure the IDE environment later. Each IDE has the following Configuration:

In IDE, You need to configure a Remote java application and run it to find the project to be deployed, and enter the host address and port number:

Before running the program, make sure that the project has been deployed in resin. If the project is deployed, You can execute it. In this case, you can set breakpoints in IDE, when accessing the service, you can execute it to the breakpoint.
Tomcat server
To configure tomcat, add a file debug. bat. The file content is
set JPDA_ADDRESS=8000 set JPAD_TRANSPORT=dt_socket SET CATALINA_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8899 startup
In fact, this is similar to resin. address is the port number for listening to jvm. At this time, you can only start the debug. bat file when starting tomcat later. The rest is the IDE configuration, which is the same as resin.
Prompt
The point mentioned here is that if you do not want to deploy the package project each time, you can change the deployment project location of resin or tomcat server to the Project location to be debugged.
Summary
With remote debugging, It is very convenient to debug some projects without printing logs.

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.