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.
Thanks for posting that - I’ve put a link to your post here: http://blogs.sun.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole
I hope it can help other developers!
Comment from: Andrew Swan [Visitor]
tilde “~” is Un*x talk for your home directory.
Maybe true, but in Windows it simply indicates that some characters in a path had to be truncated because they exceeded the MS-DOS 8.3 character limit for file and directory names. So:
Is actually an abbreviated version of:
C:\Documents and Settings\davidne\Local Settings\Temp
You’ll find that this directory does in fact exist.
Hope this helps.
Comment from: [Member]
Comment from: Mika Pussinen [Visitor]
Thanks for the info. Helped me as well. Before I knew about this TMP environment variable fix only workaround was to tell jmxremote port explicitly in command line and use remote connection facility of jconsole.
- starting of java example app to examine: java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8081 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -jar Notepad.jar
- starting of jconsole: jconsole localhost:8081
But after setting TMP to not tilde path everything worked fine without this remote connection workaround.
Comment from: Mayank [Visitor]
Form is loading...