Import java.util. *;
Import javax.management. *;
Import WebLogic.Management. *;
Import webLogic.management.configuration. *;
Import Weblogic.Management.Runtime.serverRuntimembean;
Import WebLogic.Management.Runtime.jdbcConnectionPoolRuntimembean;
Public class testjmx {
Public mbeanhome localhome;
Public mbeanhome adminhome;
Public Stack Stack;
Public static string server_name = "cgserver";
Public stack find () {
Stack = new stack ();
String Url = "T3: //127.0.0.1: 7001";
Try {
LocalHome = (MBeanhome) Helper.getmbeanhome ("WebLogic", "WebLogic", URL, Server_name;
AdminhotHome = (MBeanhome) Helper.Getadminmbeanhome ("WebLogic", "WebLogic", URL);
Set set1 = adminHome.getmbeansBytype ("JDBCTXDataSource");
Set set2 = adminHome.getmbeansbytype ("jdbcdataserce");
Iterator it1 = set1.iterator ();
While (it1.hasnext ()) {
JDBCTXDataSourceMbean DM1 = (JDBCTXDataSourceMbean) it1.next ();
System.out.println ("%%%%%%%%%%%" DM1.Getjndiname ());
Stack.Add (DM1.Getjndiname ());
}
Iterator it2 = set2.iterator ();
While (it2.hasnext ()) {
JDBCDataSourceMbean DM2 = (JDBCDataSourceMbean) it2.next ();
System.out.Println ("%%%%%%%%%%%" DM2.GetjndIName ());
Stack.add (DM2.Getjndiname ());
}
} catch (IllegalargumentException IAE) {
System.out.println ("ILLEGAL ARGUMENT Exception:" IAE);
}
Return stack;
}
Public static void main (String [] args) {
TestJMX Test = New TestJMX ();
Test.find ();
}
}