Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: MBeanServerConnectionFactoryBean reconnect

  1. #1
    Join Date
    Sep 2004
    Posts
    20

    Default MBeanServerConnectionFactoryBean reconnect

    We are trying to use MBeanServerConnectionFactoryBean in our application to make a JMX call to validate connectivity. If the server he is connected to goes down, we do not see anyway to force the bean to reconnect. Are we missing something?

    Thanks,
    David

  2. #2
    Join Date
    Mar 2007
    Posts
    4

    Default

    Hey David

    I am having the same issue have you found anything about reconnecting?
    Any help appreciated.

    Thanks
    Paul

  3. #3
    Join Date
    Mar 2007
    Posts
    4

    Default Some Sample Code

    <bean id="jmxConnection" class="org.springframework.jmx.support.MBeanServer ConnectionFactoryBean">
    <property name="serviceUrl" value="service:jmx:rmi:///jndi/rmi://localhost:10123/jmxrmi" />
    </bean>

    <bean id="smppJmxController" class="org.springframework.jmx.access.MBeanProxyFa ctoryBean">
    <property name="objectName" value="com.myname:name=MyClassJmxController"/>
    <property name="proxyInterface" value="MYCLASSNAME"/>
    <property name="server"><ref bean="jmxConnection"/></property>
    </bean>

    Now I can connect to the MYCLASSNAME however if for any reason the jmx server goes down and is then restarted or available again I cannot connect to it. It is a MVC webapp by the way the following is the error i get on the controller trying to use the mbean

    org.springframework.jmx.access.InvocationFailureEx ception: JMX access failed; nested exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
    java.net.ConnectException: Connection refused

    I want ot be able to somehoe have the server reconnect so that my calls will be successful am I doing this totally wrong?

    Any pointers appreciated.

    Thanks
    Paul

  4. #4
    Join Date
    Mar 2007
    Posts
    4

    Default

    I am now trying to reconect by call refresh in the webapplicationContext but I get the following message.

    [org.springframework.beans.factory.support.Disposab leBeanAdapter] - Couldn't invoke destroy method of bean with name 'jmxConnection'
    java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:

    Needless to say I am not getting anywhere fast with this issue please help

  5. #5
    Join Date
    Sep 2004
    Posts
    20

    Default MBeanServerConnectionFactoryBean reconnect

    We subclassed the Spring class and put the reconnect in ourselves.

    David

  6. #6
    Join Date
    Mar 2007
    Posts
    4

    Default

    Thanks David

  7. #7
    Join Date
    Nov 2004
    Location
    Atlanta, GA, USA
    Posts
    42

    Default

    Quote Originally Posted by davidr View Post
    We subclassed the Spring class and put the reconnect in ourselves.
    Would you be willing to share? This would be a fantastically useful feature for me.

  8. #8
    Join Date
    May 2007
    Posts
    1

    Default We did it but without spring

    Code attached
    Attached Files Attached Files

  9. #9

    Default

    Could someone tell me if this code really works? Seems like some nub (like me) first shot.

  10. #10
    Join Date
    Nov 2004
    Location
    Atlanta, GA, USA
    Posts
    42

    Default

    I didn't use it. Instead, I rely on Spring to handle the server-based JMX connector, but use a custom, non-Spring client that connects for each method invocation.

Posting Permissions

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