Use jvisualvm to debug local Tomcat applications

Source: Internet
Author: User

I tried to debug Tomcat with jvisualvm today, but found that Tomcat could not be found in jvisualvm. It turned out that the problem was caused by the temporary directory setting of Tomcat. Jvisualvm uses PID to find the local Java application. The PID file is stored in the temporary directory.Username> Folder. The temporary directory of Tomcat uses catalina_tmpdir:

%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

The catalina_tmpdir directory is the Tomcat directory by default.


if not "%CATALINA_TMPDIR%" == "" goto gotTmpdirset "CATALINA_TMPDIR=%CATALINA_BASE%\temp":gotTmpdir


The temporary directory of jvisualvm uses the temporary directory of the operating system by default. Therefore, jvsualvm cannot read the PID file of Tomcat and thus cannot debug tomcat.

The solution is to make jvsualvm and tomcat use the same temporary directory and set the catalina_tmpdir directory of Tomcat to the temporary directory of the system. You can add environment variables to the operating system, you can also add it in the Tomcat script.




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.