gcj & JMX

Patrick Olinet patrick.olinet@gmail.com
Wed Feb 14 15:00:00 GMT 2007

> > My gcj version is the one coming with the ubuntu 6.10 distro. It seems
> > to be a pre-4.1.2 release (built 20060928).
> >
> I reckon this will be based on Classpath 0.92.  To find out for
> definite, you can obtain the gnu.classpath.version property from your
> system properties (System.getProperties().get("gnu.classpath.version")
> or something like that).  This will have all the interfaces for
> java.lang.management, but will be missing the link to the management
> server (check for ManagementFactory.getPlatformMBeanServer() if you want
> to know for definite).

You're right, once more ;-) It's based on classpath 0.92.

> JMX is not yet complete in GNU Classpath.  javax.management will be at a
> much earlier stage back then (at present, msot of javax.management and
> all of javax.management.openmbean for 1.5 is there.  Remote
> accessibility, model mbeans and some other stuff is still missing).  You
> should be able to use mx4j with libgcj and this will give you a full
> implementation until libgcj's is ready.

That was my conclusion as well !

> Yeah, I wasn't sure in my first mail, so I was suggesting just about
> everything.  The best thing to try for the time being is to use the
> ManagementFactory class to obtain instances of the beans (see the API
> docs for this -- MemoryMXBean is probably the one you want), and see
> what information you can obtain.  At some point, it should work with
> jconsole.  It may indeed even work with current Classpath and mx4j (to
> provide remote accessibility); I haven't tried.

That's also what I've tried to do. I'm able to get and use the
MemoryMXBean from inside my application. But I'm still unable to
connect to my application through jconsole, even though I've added to
it all the RMI stuff that's supposed to help exporting the *MXBean to
the outside world. It may be that jconsole relies on Sun specific
implementations or more likely the problem is due to the fact that the
java.lang.management support in gcj is still not complete.

Anyhow, I've given up using jconsole and I've implemented a wrapper
that starts my application and monitors the heap size. This solution
is not as beautiful as the full JMX one, but it works !

Thanks again for your support.


More information about the Java mailing list