Intellij IDEA applications in remote-adjusting running on the Tomcat

Intellij IDEA want to use the remote debugging running on Tomcat, you only need to complete the following two steps:

  1. Enable remote debugging of Tomcat, then start Tomcat;
  2. Adding remote debugging configuration items in Intellij IDEA, and then start remote debugging.

The following will explain how the above operation.

1. Enable remote debugging feature of Tomcat

Tomcat remote debugging feature, you can start by adding the appropriate parameters to enable virtual machine, and the environment variable declaration is usually used as the main way that we add a virtual machine startup parameters.
Here we have three environment variables to choose from, they are:

  1. JPDA_OPTS
  2. CATALINA_OPTS
  3. JAVA_OPTS

JPDA_OPTS

In the Tomcat installation directory (hereinafter referred to as CATALINA_HOME ), find bin directory, and create a new directory named in the setenv.sh script files (Windows platforms, file extensions should be .bat ). If the file already exists, you can skip this step.
Edit setenv.sh file, add the following:

export JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"

If you are in the Windows platform, add the following:

set "JPDA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"

Then use the command catalina.sh JPDA Start (Windows platform, command catalina.bat JPDA Start ) to start Tomcat.

CATALINA_OPTS 或 JAVA_OPTS

Use CATALINA_OPTS or the JAVA_OPTS , and JPDA_OPTS The only difference is that, use the command catalina.sh Start (Windows platform, command catalina.bat Start ) to start Tomcat.

2. Add the remote debugging configuration items in the Intellij IDEA

Click Run → Edit Configurations Options

Click the + button in the upper left corner, select the Remote option

on the right side of the formula bar, fill in the corresponding remote IP address and port number

Click OK to save the configuration item information.
Click Run → Debug, select the above configuration items, you can begin remote debugging.

Guess you like

Origin www.cnblogs.com/dlzer/p/how-to-remotely-debug-application-running-on-tomcat-from-within-intellij-idea.html