As you know I have been doing a lot of work with Java application containers and the like. I have recently been looking at Java Management Extensions. What is JMX?
JMX is a technology that lets you implement management interfaces for Java applications.Copied that line from here, but the idea is that you write a java managed bean (MBeans) and register it with the JMX infrastructure. The JMX technology handles how people get at that information or service. The MBean can do several things like, peek at information, poke new values, initiate calls in the application or do notifications. There is a handy set of tutorials written by Sun to help you learn. I tried them but unfortunately I couldn’t get it to work. I compiled the java files exactly the way the instructions described, and when the instructions said launch
Select com.example.mbeans.Main from the list in the “New Connection” window, and click on “Connect".My window did not have that class listed. Mine had the java process id only. When I used
jps(java process list), it said:
668 – process information unavailable 2468 JpsI eventually had to ask a question in Sun’s JMX forum and was pointed to the troubleshooting connection problems in jconsole, which although was not completely accurate it did point me in the direction of success. The problem comes from the the
TMPenvironment variable. Under windows my environment variable was set to:
C:\tmp\jmx_examples\Essential>echo %TMP% C:\DOCUME~1\davidne\LOCALS~1\TempI know (cos I’m a Un*x bod) that tilde “~” is Un*x talk for your home directory. I think that my
TMPvariable’s “~” was being translated to:
C:\DOCUME\Documents and Settings\davidne1\davidne\LOCALS\Documents and Settings\davidne1\Tempwhich does not exist! As a result
jconsoleand my JMX application could not communicate with each other and therefore could not make a connection. To fix the problem I changed the environment variable
TMPto point to a real directory on an (NTFS partition (sorry another caveat)) without any funny characters in it:
set TMP=c:\tmpRe-ran my mbeans application and all was well.