weblogic server开放JMX接口,所需就是编写JMX的客户端
关于版本:
weblogic 9.0为分界。
MBean入口——之前:MBeanHome,deprecated;之后:javax.management.MBeanServerConnection
大概步骤:
weblogic 管理服务器上维护了oracle提供的3个MBeanServer和JDK提供的可选择的platform MBean server。
This MBean server | Creates, registers, and provides access to... |
---|---|
Domain Runtime MBean Server | MBeans for domain-wide services. This MBean server also acts as a single point of access for MBeans that reside on Managed Servers. You can register your own (custom) MBeans in this MBean server (see "Registering Custom MBeans in the Domain Runtime MBean Server" in Developing Manageable Applications With JMX for Oracle WebLogic Server). If your JMX client accesses WebLogic Server MBeans in this MBean server by constructing object names, the client must add a Only the Administration Server hosts an instance of this MBean server. |
Runtime MBean Server | MBeans that expose monitoring, run-time control, and the active configuration of a specific WebLogic Server instance. You can also register your own (custom) MBeans in this MBean server (see "Registering Custom MBeans in the Domain Runtime MBean Server" in Developing Manageable Applications With JMX for Oracle WebLogic Server). In this release, the WebLogic Server Runtime MBean Server is configured by default to be the platform MBean server. However, you can configure WebLogic Server to create a separate MBean Server and use it instead of the platform MBean Server. See Using the Platform MBean Server. Each server in the domain hosts an instance of this MBean server. |
Edit MBean Server | Pending configuration MBeans and operations that control the configuration of a WebLogic Server domain. It exposes a Only the Administration Server hosts an instance of this MBean server. |
The JVM's platform MBean server | MBeans provided by the JDK that contain monitoring information for the JVM itself. You can register custom MBeans in this MBean server. In this release, WebLogic Server uses the JVM's platform MBean server to contain the WebLogic run-time MBeans by default. As such, the platform MBean server provides access to platform MXBeans, WebLogic run-time MBeans, and WebLogic configuration MBeans that are on a single server instance. See Using the Platform MBean Server, and "Registering MBeans in the JVM Platform MBean Server" in Developing Manageable Applications With JMX for Oracle WebLogic Server. |
1. 连接到某MBeanServer
2. 获取connection
3. 通过connection.getAttribute(ObjectName, String)方法逐层获取
注意点:
JMXServiceURL指定协议时,除iiop协议为jdk自带实现,其余协议(t3/http/t3s/https/iiops)需要导入wljmxclient.jar。
并指定connect 的environment变量中协议实现包位置,否则报错unsupported propocol
env.put("jmx.remote.protocol.provider.pkgs" ,"weblogic.management.remote");
connector=JMXConnectorFactory.newJMXConnector(serviceUrl, env);
connector.connect(env);
资料总结:
Accessing WebLogic Server MBeans with JMX(9.0):http://docs.oracle.com/cd/E13222_01/wls/docs90/jmx/accessWLS.html#1112969
Understanding WebLogic Server MBeans(9.0):http://docs.oracle.com/cd/E13222_01/wls/docs90/jmx/understandWLS.html
使用 JMX 访问 WebLogic Server MBean(9.2):http://edocs.weblogicfans.net/wls/docs92/jmx/accessWLS.html
了解 WebLogic Server MBean(9.2):http://edocs.weblogicfans.net/wls/docs92/jmx/understandWLS.html#wp1127815
Understanding WebLogic Server MBeans(11g):http://docs.oracle.com/cd/E23943_01/web.1111/e13728/understandwls.htm#JMXCU113
weblogic server MBean reference:http://docs.oracle.com/cd/E13222_01/wls/docs90/wlsmbeanref/core/index.html(具体MBean层次结构)