Announcement Announcement Module
Collapse
No announcement yet.
Full example of JMX in spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Anonymous
    started a topic Full example of JMX in spring

    Full example of JMX in spring

    Hi,

    Can anyone tell me what else I need to do apart from the description from
    http://www.springframework.org/docs/reference/jmx.html, as I cannot see my bean in jconsole, although the program runs.

    It seems the code I added in XML file doesn't create the server at all.

    Do I need to code any for Mbean server part? if so can any one post a simple example for me, thanks.

  • MBA Updates
    replied
    public class AnnotatedStandardMBean extends StandardMBean {

    /** Instance where the MBean interface is implemented by another object. */
    public <T> AnnotatedStandardMBean(T impl, Class<T> mbeanInterface)
    throws NotCompliantMBeanException {
    super(impl, mbeanInterface);
    }

    /** Instance where the MBean interface is implemented by this object. */
    protected AnnotatedStandardMBean(Class<?> mbeanInterface)
    throws NotCompliantMBeanException {
    super(mbeanInterface);
    }

    @Override
    protected String getDescription(MBeanOperationInfo op) {
    ...
    }

    ...other overrides...
    }



    Business School Rankings
    Best MBA Programs

    Leave a comment:


  • lisdey89
    replied
    The same problem

    I have the same problem, I can't see my bean in jconsole. I read the previous post, but I do not understand the lines of code to initialize the objects defined in the configuration because they have many strange characters, plus I do not know where are the examples in the distribution of spring. I'm very new in spring someone can help me please?

    Thanks in advance

    Leave a comment:


  • Costin Leau
    replied
    You have a working example inside the spring distribution.

    Leave a comment:


  • alex68
    replied
    Instantiate objects!

    Spring configuration is only half part of the solution.
    You have also to instantiate the objects defined into the configuration.

    Example:

    Code:
    <beans>
            <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"/>
    
            <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
                    <property name="beans">
                            <map>
                                    <entry key="bean&#58;name=test" value-ref="testBean"/>
                            <map>
                    </property>
    
                    <property name="server" ref="mbeanServer"/>
            </bean>
    
            <bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean">
                    <property name="objectName" value="connector&#58;name=rmi"/>
                    <property name="serviceUrl"
                              value="service&#58;jmx&#58;rmi&#58;//localhost/jndi/rmi&#58;//localhost&#58;1099/myconnector"/>
    
                    <property name="threaded" value="true"/>
                    <property name="daemon" value="true"/>
                    <property name="server">
                            <ref local="mbeanServer"/>
                    </property>
            </bean>
    
            <bean id="registry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">
              <property name="port" value="1099"/>
            </bean>
    
    ...
    In your application:

    Code:
    public static void main&#40;String&#91;&#93; args&#41; &#123;
    
      ...
     Object serverConnector=getFactory&#40;&#41;.getBean&#40;"serverConnector"&#41;;
     Object exporter=getFactory&#40;&#41;.getBean&#40;"exporter"&#41;;
     ...
    &#125;
    That's All!

    (As in test\org\springframework\jmx\export\MBeanExporterT ests.java)

    Leave a comment:


  • Guest
    replied
    JConsole &amp; MBeanServerFactoryBean

    So, why does the JConsole not show the Mbean when we use the MBeanServerFactoryBean to our configuration as shown in 18.2.1 of the JMX document. Java 1.5 VM has MBeanServer 1 : com.sun.jmx.mbeanserver.JmxMBeanServer server in there.
    Thanks.

    Leave a comment:


  • george123
    replied
    Sorry, I try to get a stand alone server with jdk 1.5.

    Leave a comment:

Working...
X