1

weblogic に接続し、webapp が依存しているすべてのライブラリを一覧表示する単純なクライアント アプリケーションを作成しています。ただし、オブジェクト名の適切な属性を見つけるのが困難です。例えば、

MBeanServer に接続するために oracle.com で提供されている以下のサンプル コードを見ると、

public static void initConnection(String hostname, String portString,
  String username, String password) throws IOException,
  MalformedURLException {

  String protocol = "t3";
  Integer portInteger = Integer.valueOf(portString);
  int port = portInteger.intValue();
  String jndiroot = "/jndi/";
  String mserver = "weblogic.management.mbeanservers.edit";

  JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname, port,
  jndiroot + mserver);

  Hashtable h = new Hashtable();
  h.put(Context.SECURITY_PRINCIPAL, username);
  h.put(Context.SECURITY_CREDENTIALS, password);
  h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,
     "weblogic.management.remote");
     connector = JMXConnectorFactory.connect(serviceURL, h);
     connection = connector.getMBeanServerConnection();


}

public ObjectName startEditSession() throws Exception {
  // Get the object name for ConfigurationManagerMBean.
  ObjectName cfgMgr = (ObjectName) connection.getAttribute(service,
     "ConfigurationManager");



  // Instruct MBeanServerConnection to invoke
  // ConfigurationManager.startEdit(int waitTime int timeout).
  // The startEdit operation returns a handle to DomainMBean, which is
  // the root of the edit hierarchy.
  ObjectName domainConfigRoot = (ObjectName) 
     connection.invoke(cfgMgr,"startEdit", 
     new Object[] { new Integer(60000),
     new Integer(120000) }, new String[] { "java.lang.Integer",
     "java.lang.Integer" });
  if (domainConfigRoot == null) {
     // Couldn't get the lock
     throw new Exception("Somebody else is editing already");
  }
  return domainConfigRoot;




}



ObjectName cfgMgr = (ObjectName) connection.getAttribute(service, " ConfigurationManager ");

JMX 属性ConfigurationMangerを参照しています。weblogic で特定のオブジェクト名の下にあるすべての属性を見つけるにはどうすればよいでしょうか?

ご協力いただきありがとうございます!!

4

2 に答える 2

0

おそらく、WebLogic Classloader Analysis Tool (CAT)を使用すると、すぐに追加の洞察を得ることができます...

于 2014-06-10T16:03:00.747 に答える
0

どうでも!解決策を見つけました。

ServerConnection で getBeanInfo を呼び出して、ObjectName の属性を取得します。

例: MBeanAttributeInfo[] beanInfo = (connection.getMBeanInfo(objectName)).getAttributes();

for(MBeanAttributeInfo info:beanInfo) System.out.println(info.getType()+" "+info.getName());

于 2014-06-10T15:58:04.897 に答える