Announcement Announcement Module
Collapse
No announcement yet.
How can I browse mbeans exported by spring in a console app Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I browse mbeans exported by spring in a console app

    I have add mbeanserver to my app like this

    <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServer FactoryBean"/>

    <bean id="exporter" class="org.springframework.jmx.export.MBeanExporte r">
    <property name="beans">
    <map>
    <entry key="bean:name=hellor1" value-ref="hellor1"/>
    <entry key="bean:name=httpConnector">
    <ref local="httpConnector"/>
    </entry>
    </map>
    </property>
    <property name="server" ref="mbeanServer"/>
    </bean>

    and I have added -Dcom.sun.management.jmxremote to the jvm parameters
    when the app starts, spring framework's log claims that the server has been created and the mbeans have been created.
    when I connect to the app through Jconsole. It connected successfully but none of spring created mbean is show. Only jdk's mbeans are there.
    On the other hand, if I use Jconsole to connect to a tomcat server which has spring web apps deployed, Jconsole does show all the mbeans. :shock:
    What is wrong?Plean help me

  • #2
    Hi, I have worked it out.
    Simply change the mbeanserver configuration to
    <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServer FactoryBean">
    <property name="locateExistingServerIfPossible" value="true"/>
    </bean>
    and it works.
    I belive -Dcom.sun.management.jmxremote tell jvm to create its own mbeanserver, it is this server which Jconsole connected to.
    And we need "hook" spring's mbeanserver to jvm's
    locateExistingServerIfPossible can do this.

    Comment


    • #3
      help..

      Hi, I have worked it out.
      I do not know how to stop this.

      Comment


      • #4
        Re: help..

        Originally posted by Anonymous
        Hi, I have worked it out.
        I do not know how to stop this.
        don't know what you mean. But if you mean my English is poor... Yes.

        Comment

        Working...
        X