2 Replies Latest reply on Oct 18, 2004 2:43 PM by Damon Kilgore

    Accessing Managed Connection information via MBeans

    Damon Kilgore Newbie

      I'm not exactly sure how to ask the question, so please bear with me.

      In the JMX-Console, under jboss.jca, I see that I can see quite a bit of information about each of my database connection pools, such as MaxConnectionsInUseCount, MaxSize, etc. I would like to programatically access this information and I'm a bit stuck.

      For starters, I'm just trying to get information on just one of them. Here is a sample of the code:

      MBeanServer mbeanServer = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
      ObjectName dsName = new ObjectName("jboss.jca:name=myDS,service=ManagedConnectionPool");

      Object[] args = {};
      String[] sig = {};

      String availableCount = (String) mbeanServer.invoke(dsName, "getAvailableConnectionCount", args, sig);

      System.out.println("count: " + availableCount);

      I grabbed the name from the jmx-console, and can see the information about my connection pool right there, but when I run this code, I get an exception:

      ReflectionException: null
      Cause: java.lang.NoSuchMethodException: Unable to locate MBean operation for: getAvailableConnectionCount()

      So how do I find out what methods are available to me in order to pull this information? Are there any good references for understanding MBeans better? I've written a couple of simple ones, but I haven't figured out how to get access to ones I haven't written.

      Any help would be greatly appeciated!

      Damon