Tomcat is also a Java application, isn’t it? So when I launch VisualVM (when local Tomcat is already running), the icon cat must be there!
However, when I use JDK 6 (>=6u23), I cannot see it.
According to Internet blogs and disscussion, the reason is that:
Tomcat (>= Version 6) does not write its “TEMP File” into system default temp folder. It uses the private folder!
In contrast, monitoring tools (like JConsole, VisualVM, etc.) tend to find local applications by checking temperory files in “SYSTEM DEFAULT FOLDER”. So that is why monitoring tools cannot find Tomcat.
There are two solutions:
1, Build Remote Connection in Monitoring tools. By treating “disappeared” Tomcat as a “Remote” java application, the monitoring tools no longer need the “TEMP FILE” of local Tomcat.
If you choose this solution, you need to:
(a) defind customized variables in Tomcat’s configuration folder (e.g. %Tomcat_Root%/bin) as follows:Step 1 : Create file which name is “setenv.bat” // if you use Unix, it should be “setenv.sh”
Step 2 : create variable CATALINA_OPTS as follows:
set "CATALINA_OPTS=-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
Here pay attention that the separator between different options is a single SPACE, rather than any other character or Line-Change.
(b) then you can start Tomcat by run the “startup.bat” (// ”startup.sh” for linux)
(c) create new “Add JXM Connection”, input the configuration string as “localhost:9090”. // here the port should be same as what you defined in “setenv.bat” file. Then click OK. You will find a “Remote” Icon cat appears.
2, You can also choose to solve the “TEMP FILE MISSING” problem. If you choose this, you need to:
(a) create the “setenv.bat” file in %Tomcat_Root%/bin folder, and then add the following variable.(b) then you can start your Tomcat again. You will see the Icon Cat appear now.set "CATALINA_TMPDIR=%TEMP%"