Support Wikipedia Follow My Heart: Why VisualVM cannot find Local Tomcat automatically ?

2011年12月1日星期四

Why VisualVM cannot find Local Tomcat automatically ?

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:

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.

没有评论:

发表评论