a program, deployed on their own computer,debug debugging, I believe everyone will, However, if I want debug debug Non-local deployment of the program what to do. For example, a program deployed on a test server.
In fact, such a demand is often, such as a large project has many modules, there are many of their own or external dependence, it is impossible to build a complete set of environment on their own computer. No matter how complex, sometimes the company's computer configuration does not give force, the deployment of a large program is even worse. Typically such programs are deployed directly into a dedicated development or test environment. Testing is rarely deployed on your own computer. Plus, with an automated deployment tool like Jenkins, deployment is just a matter of a few clicks of a button. No more work than a tomcat on the local. It is even more unnecessary to test the local deployment program. This includes developing self-test and testing personnel. Of course this is just a slightly bigger item. It is convenient to deploy tests on a small, standalone project locally.
Well, to get to the point, since the deployment to other places, you want to debug step-by-step debugging can not be as local deployment. This is the question raised at the beginning of the article.
In fact, it's easy to solve.
-
- set up Tomcat
In the Tomcat catalina.sh file that the target program runs, add
java_opts="-xdebug-xnoagent-djava.compiler=none-xrunjdwp:transport=dt_socket,server=y,suspend=n, address=26310"
Of course, this may be just a minimal configuration to enable remote debug, which can of course be set with other JVM parameters. Parameters like common settings for heap memory size, garbage collector, GC log printing, stack dump, and so on.
Well, that's all the settings the target Tomcat needs to do, simple.Note the settings hereAddress=26310, which is the port for local and remote program communication, and is set in the IDE tool later.having done the work, it was almost half done.
- Idea Settings
Click Location
then click "Edit configurations ..."
The following screen appears, then click the plus sign in the upper left corner
appear as the interface, click Remote
finished setting click Apply
If you want to remotely debug, select the location you just set.
then click on the Debug button to break the point on your machine to debug your remote deployment's code
- Other IDE Tools I do not how to use, I do not know how to set up, need to study under their own.
Idea debug a program deployed on a server