PDA

View Full Version : tomcat restart issue with jmx



sreedhargattu
May 29th, 2007, 04:26 AM
Hi,

I have two applications communicating each other using jmx. For example

application 1 ==> Source application
application 2 ==> deployed under tomcat that communicates to "application 1" using jmx as follows
<bean id="clientConnector" class="org.springframework.jmx.support.MBeanServerConnect ionFactoryBean>
<property name="serviceUrl"
value="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/test"/>
<property name="environment">
<props>
<prop key="jmx.remote.jndi.rebind">true</prop>
</props>
</property>
</bean>

Whenever application 1 is restarted (without being tomcat(application 2) restarted) the connection becomes stale in application 2. Is there any way to get around this. For RmiProxyFactoryBean we have some thing like refreshStubonConnectFailure. Is there any similar thing for jmx..

Thanks for your help!!!

Dave Syer
Jun 27th, 2007, 03:34 PM
The closest analogy to RmiProxyFactoryBean in JMX is the MBeanProxyFactoryBean (which unfortunately has no direct equivalent of refreshStubOnConnectFailure, but maybe you can sort of fake it by manipulating the server property of the FactoryBean). Would it be better to use that? How exectly are you using the server connection supplied by the ConnectionFactoryBean?

sreedhargattu
Jun 29th, 2007, 07:13 AM
Thanks for the reply. I am getting connection as follows

public JMXClient(MBeanServerConnection jmxConn, String mBeanObjectName) throws Exception {
this.jmxConn = jmxConn;
this.mBeanObjectName = new ObjectName(mBeanObjectName);
initialise();
}

private void initialise() throws Exception {
clientRes = new MYJMXClientResult(jmxConn);
beanInfo = jmxConn.getMBeanInfo(mBeanObjectName);
operationInfos = beanInfo.getOperations();
}