Jmx Tutorial 笔记

1.MBean 接口的命名一定要以MBean或MXBean结尾,否则报:
Exception in thread "main" javax.management.NotCompliantMBeanException: MBean class com.example.mbeans.Hello does not implement DynamicMBean, neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class com.example.mbeans.Hello is not a JMX compliant Standard MBean) nor the MXBean conventions (javax.management.NotCompliantMBeanException: com.example.mbeans.Hello: Class com.example.mbeans.Hello is not a JMX compliant MXBean)
at com.sun.jmx.mbeanserver.Introspector.checkCompliance(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(Unknown Source)
at com.example.mbeans.Main.main(Main.java:28)

2.Server start前必须用 rmiregistry 9999 注册端口,或者LocateRegistry.createRegistry(9999);

3.使用Subject Delegation(使用java.policy)来控制权限,不能在eclipse执行Server,
因为jvm会任务bin目录也是一个Protected Domain,这样没有包含权限。
access: domain that failed ProtectionDomain (file:/D:/code/jmx_examples/bin/ <no signer certificates>)
sun.misc.Launcher$AppClassLoader@e48e1b
<no principals>


4.access.properties控制访问权限
样例:
username readwrite create SimpleStandard unregister
password.properties控制用户和密码
样例:
username password

5.MXBean 和MBean的区别在于MBean指定定义基本类型参数的接口,MXBean可以是复杂对象参数的接口。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值