1) Connect to admin server
JMXConnector m_connector;
MBeanServerConnection m_connection;
JMXServiceURL serviceURL = new JMXServiceURL("t3","192.168.1.1",7000,"/jndi/weblogic.management.mbeanservers.domainruntime");
System.out.println("Connecting to: " + serviceURL);
Hashtable h = new Hashtable();
h.put("java.naming.security.principal", "wladmin");
h.put("java.naming.security.credentials", "Welcome1");
h.put("jmx.remote.protocol.provider.pkgs", "weblogic.management.remote");
m_connector = JMXConnectorFactory.newJMXConnector(serviceURL, h);
m_connector.connect();
m_connection = m_connector.getMBeanServerConnection();
2) Read Dispatcher Trace
String result=(String)m_connection.invoke("oracle. as. soainfra. bpm: Location=SERVER_NAME, name=CubeDispatcher, type=bpel", "readXMLDispatcherTrace",null,null);
3) Query the results
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc ;
XPathFactory xPathfactory = XPathFactory.newInstance();
XPath xpath = xPathfactory.newXPath();
XPathExpression expr;
String invokeScheduled="//dispatcher-trace/invokeSet/invokeQueue/scheduled/@count";
String invokeWorking="//dispatcher-trace/invokeSet/invokeQueue/working/@count";
String engineScheduled="//dispatcher-trace/engineSet/instanceQueue/scheduled/@count";
String engineWorking="//dispatcher-trace/engineSet/instanceQueue/working/@count";
int is=0;
int iw=0;
int es=0;
int ew=0;
inStream.setCharacterStream(new StringReader(result));
is=Integer.parseInt(xpath.evaluate(invokeScheduled,inStream));
System.out.println("Invoke Scheduled: "+is);
inStream.setCharacterStream(new StringReader(result));
iw=Integer.parseInt(xpath.evaluate(invokeWorking,inStream));
System.out.println("Invoke Working: "+iw);
inStream.setCharacterStream(new StringReader(result));
es=Integer.parseInt(xpath.evaluate(engineScheduled,inStream));
System.out.println("Engine Scheduled: "+es);
inStream.setCharacterStream(new StringReader(result));
ew=Integer.parseInt(xpath.evaluate(engineWorking,inStream));
System.out.println("Engine Working: "+ew);
4) Make a loop mechanism in order to query all your servers.