Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: MBeanServerConnectionFactoryBean reconnect

  1. #11
    Join Date
    Dec 2007
    Posts
    3

    Default

    Code:
    <bean id="connector"   
    class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean"
            lazy-init="true" scope="prototype">
            <property name="serviceUrl"
                value="service:jmx:rmi://..."/>
        </bean>
    
        <bean id="control"
            class="org.springframework.jmx.access.MBeanProxyFactoryBean"
            lazy-init="true" scope="prototype">
            <property name="objectName" value="..." />
            <property name="proxyInterface"
                value="a.b.c.Control" />
            <property name="server" ref="connector" />
            <property name="connectOnStartup" value="false" />
        </bean>
    
        <!-- 
                use the factory to lookup the control, 
                in case the jmx server restarts 
         -->
        <bean id="controlFactory"      
    class="org.springframework.beans.factory.config.ObjectFactoryCreatingFactoryBean">
            <property name="targetBeanName">
                <idref local="control" />
            </property>
        </bean>

  2. #12
    Join Date
    Mar 2012
    Posts
    2

    Default

    I know this thread is a little old, but I was facing the same problem and found a solution without having to write my own code.

    I'm using Spring 3.0.5.RELEASE

    Code:
       <bean id="myMonitor" class="org.springframework.jmx.access.MBeanProxyFactoryBean" lazy-init="true">
            <property name="objectName" value="etl:name=..."/>
            <property name="proxyInterface" value="..."/>
            <property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmxrmi"/>
            <property name="refreshOnConnectFailure" value="true" />
        </bean>
    You can't use this method of refreshOnConnectFailure with MBeanServerConnectionFactoryBean it only works if you specify serviceUrl directly on your MBeanProxyFactoryBean.

  3. #13
    Join Date
    Mar 2012
    Posts
    2

    Default

    Well the original post was very old so maybe there was no solution for the problem back than but I posted a solution with current Spring version that worked great for me.

    Have you tried it? If you're having specific problems, maybe I can help.
    Just provide more details.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •