tags:

views:

38

answers:

0

Hello, I'm trying to build a jconsole-like application which is able to remote-monitor a jvm.. so far i've get it working for "every" sun-jvm.. now my boss wants me to monitor a ibm j9 jvm.. which doesn't work..

i have this simple test code:

import java.io.IOException;
import java.lang.management.ManagementFactory;

import javax.management.MBeanServerConnection;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

import com.ibm.lang.management.MemoryMXBean;

public class IBMConnection {
 public static void main(String[] args) throws IOException {

  JMXConnector jmxc;

  // create jmxserviceurl
  //
  JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"
    + "myhost:1234" + "/jmxrmi");

  // connect to jmx service running application with the jmxurl
  //
  jmxc = JMXConnectorFactory.connect(url, null);

  // create MBeanServerConnection with jmxconnection
  //
  MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

  MemoryMXBean ibmOSMXBean;

  ibmOSMXBean =  ManagementFactory
    .newPlatformMXBeanProxy(mbsc, ManagementFactory.MEMORY_MXBEAN_NAME,
      MemoryMXBean.class);

  System.out.println(ibmOSMXBean.getMaxHeapSize());


 }
}

i'm running the application on my local machine, (xp sp3, sun jre-6u16) and trying to connect to "myhost" (AIX 1 6 00CDAB5A4C00 running IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 AIX ppc-32 j9vmap3223-20081129).

it works if i start the application on the aix machine and connect "remote" to itself, but if i am doing it real-remote it throws me this exception:

Exception in thread "main" java.lang.IllegalArgumentException: java.lang:type=Memory is not a platform MXBean
 at java.lang.management.ManagementFactory.newPlatformMXBeanProxy(Unknown Source)
 at IBMConnection.main(IBMConnection.java:32)

so i thought: okay, objectname incorret, and changed ManagementFactory.MEMORY_MXBEAN_NAME to "com.ibm:type=Memory" and "com.ibm.lang:type=Memory", but thatd didn't help neither...

i have found no information on how to connect remote to the ibm mxbeans... i'm pretty desperate atm..

there is no firewall, i used the fully qualified domain name of "myhost", the port is open and accessible (says nmap, and jconsole is able to connect to the app.), the application (which should be monitored) is started with the correct parameters.. i'm running eclipse 3.5 and i have imported the jlm.jar archive from the ibm eclipse-package.. i can see all the methods from the package, but i'm not able to call them remotely through an mbeanproxy... please help me