I take that back - it has nothing to do with tomcat. as instructed in the JMX tutorial (http://docs.oracle.com/javase/tutorial/jmx/overview/javavm.html), i started the demo Notepad app
and then tried connecting JConsole - no luck: i get the same "management agent blah blah blah" error.
this scenario sounds so plain-jane it's infuriating.
i have java 6 (1.6.0_29) and Tomcat 6.0.35 (installed as a service - so i have a tomcat6.exe, not a catalina.bat or other) on Win 7.
i start tomcat6, and then JConsole, but JConsole grays out tomcat's pid and tells me "management agent is not enabled on this process".
the docs say any process running on the java 6 vm should automatically be attachable.
even if i add the "-Dcom.sun.management.jmxremote" (which i absolutely shouldn't have to on java6), it still doesn't work.
What am i missing?
Found the needle in the haystack, for anyone who gets afflicted with this bizarre 1 in a million (i assume) scenario:
Within the %TEMP% folder in Windows 7, is a hsperfdata_<windows user id> folder where java stores the PIDs of java processes. this post (https://blogs.oracle.com/lmalventosa/entry/jconsole_local_process_list_on) was very helpful, and although the usual windows 7 folder permissions change didn't help, this specific comment in that post (https://blogs.oracle.com/lmalventosa/entry/jconsole_local_process_list_on#comment-1271160942000) hit the nail on the head (or rather, pulled it out of mine), when it said that the case of the user id in the file name was wrong, and changing it helped. that solved it for me as well - e.g. instead of hsperfdata_sg0578082 (my user id), changing it to hsperfdata_SG0578082 (capitalizing the "sg") was my ticket to Nirvana.
Why? i have no clue. but it's not the first time that windows pretending to be case-sensitive, but really being completely insensitive, has bit me...