Monday, September 10, 2012

QuickTip: Programmatic MBean access under JBoss

I have been struggeling a bit with the programmatic access of MBeans under JBoss. This is my current conclusion.
With JBoss 5 there are two methods for accessing MBeans:
  • By JNDI-lookup of the RMIAdaptor. With this method you need the JBoss client libraries (the jars in your $JBOSS_HOME/client) on the classpath since the RMIAdaptor is a type that is provided by JBoss.
  • By pure JMX. You don't need the JBoss client libraries your class path here. 

The following snipped shows both methods:

With JBoss 7 the way to access MBeans changed quite a bit: The tricky thing here is, that you need the JBoss client libraries (the jars in $JBOSS_HOME/bin/client) on your classpath even though you don't explicitly import types provided by JBoss.

If the client libraries are missing, you get the following exception: java.net.MalformedURLException: Unsupported protocol: remoting-jmx

As far as I could figure, this is the only way to access MBeans under JBoss 7.

2 comments:

  1. nice and simple; thanks for the buildpath tip also ;)

    ReplyDelete
  2. Please can you provide way how to use user/password in your code to access AS7?
    Thank you
    Michal

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...