Cannot integrate JMX with Spring application

后端 未结 2 1779
悲&欢浪女
悲&欢浪女 2021-01-07 04:11

I have got a SPRING application. When I run

mvn jetty:run

everything is ok.

I would like to use JMX

2条回答
  •  情歌与酒
    2021-01-07 04:53

    Caused by: javax.management.InstanceAlreadyExistsException: bean:name=testBean1

    This is trying to tell you that you have 2 beans with the same name ObjectName of bean:name=testBean1 being register with the MBeanExporter. However, unless there are other XML files or more entries in your beans map then there should not be.

    I have no even idea how to debug it.

    You could put a breakpoint in the JmxMBeanServer.registerMBean(...) method to see what beans are being registered to see if you can figure out why you are getting a duplicate.


    As an aside, my SimpleJMX library is an easy way to export your beans via JMX. There is pretty good Spring support as well. Here are the documentation about using with Spring. There is also a Spring test program which demonstrates what you need to do to get it working. Here's the Spring XML file.

提交回复
热议问题