jmx
2016-05-13 13:59
288 查看
JMX是暴露监测和管理您的应用程序部件的好办法。春天还提供远程管理支持暴露JMX(jsr-160)和创建一个客户端管理。这个例子注册Spring bean作为一个JMX MBean,暴露了JMX服务器在JMX通讯协议(jmxmp),并创建一个客户端访问它。
连接到实例使用JMX管理工具,可以使用自带的JDK的安装。IDE中的断点可以设置在单元测试或thread.sleep可以增加暂停应用程序关闭。激活局部JMX访问,java的说法-dcom.sun.management.jmxremote测试开始时必须使用。
背景:部分扫描创建从servermanagerimpl弹簧豆。
http://docs.spring.io/spring/docs/4.1.x/spring-framework-reference/html/jmx.html
配置文件
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd">
<bean id="mBeanExporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="assembler" ref="assembler" />
<property name="namingStrategy" ref="namingStrategy" />
<property name="server">
<bean class="javax.management.MBeanServerFactory" factory-method="createMBeanServer"></bean>
</property>
<property name="autodetect" value="true"/>
</bean>
<bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
<property name="attributeSource" ref="jmxas" />
</bean>
<bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNamingStrategy">
<property name="attributeSource" ref="jmxas" />
</bean>
<bean id="jmxas" class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource" />
<bean id="htmlAdaptorServer" class="com.sun.jdmk.comm.HtmlAdaptorServer" init-method="start">
<constructor-arg index="0" value="" />
<constructor-arg index="1" ref="authInfo" />
</bean>
<bean id="authInfo" class="com.sun.jdmk.comm.AuthInfo" >
<property name="login" value="" />
<property name="password" value="" />
</bean>
很简单的可以看下官网,
连接到实例使用JMX管理工具,可以使用自带的JDK的安装。IDE中的断点可以设置在单元测试或thread.sleep可以增加暂停应用程序关闭。激活局部JMX访问,java的说法-dcom.sun.management.jmxremote测试开始时必须使用。
背景:部分扫描创建从servermanagerimpl弹簧豆。
http://docs.spring.io/spring/docs/4.1.x/spring-framework-reference/html/jmx.html
配置文件
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd">
<bean id="mBeanExporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="assembler" ref="assembler" />
<property name="namingStrategy" ref="namingStrategy" />
<property name="server">
<bean class="javax.management.MBeanServerFactory" factory-method="createMBeanServer"></bean>
</property>
<property name="autodetect" value="true"/>
</bean>
<bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
<property name="attributeSource" ref="jmxas" />
</bean>
<bean id="namingStrategy" class="org.springframework.jmx.export.naming.MetadataNamingStrategy">
<property name="attributeSource" ref="jmxas" />
</bean>
<bean id="jmxas" class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource" />
<bean id="htmlAdaptorServer" class="com.sun.jdmk.comm.HtmlAdaptorServer" init-method="start">
<constructor-arg index="0" value="" />
<constructor-arg index="1" ref="authInfo" />
</bean>
<bean id="authInfo" class="com.sun.jdmk.comm.AuthInfo" >
<property name="login" value="" />
<property name="password" value="" />
</bean>
很简单的可以看下官网,
相关文章推荐
- JMX和MBean以及pojo-mbean学习
- 调用主机上的JMX服务时出现异常的IP
- 通过JMX监控tomcat在Linux下的设置
- JMX学习之MBean
- Felix?OSGi? -初步了解
- ActiveMQ (2)
- J2EE运行环境性能优化艺术之二
- JMX中一个MBean的异常
- J2EE开源消息中间件大比拼
- Java SE 6 新特性: JMX 与系统管理
- cluster
- 继续进阶的学习自律
- 了解 Java SE 6 新特性系列
- 关于The MBean class could not be loaded by the default loader repository的解决方法
- JConsole的使用手册(转载)
- jmx在tomcat中的应用
- 使用AdminClient 连接Websphere 7
- 大家是不是都不看这个?
- JBOSS5.0 Beta4 配置详解
- what's QMF?