I have 2 web applications running in Tomcat (version 6.0.14). One (web) provides a GUI to amend application parameters. When these are changed, I have a service which publishes a notification to 2 listeners, one listener within the same application (web) and the other in another in a separate application (hub). The listeners should then reload the application parameters so that they are available to the code in each application.
The publishing/listening mechanism works fine within the same application (web), but I cannot get the listener in the remote application (hub) working.
My configuration within the web application is:
Configuration within the hub application is:Code:<!-- JMX EXPORTER START --> <!-- Listens for updates to SystemParameters within Web --> <bean name="ent.webSystemParameterChangeListener" class="uk.co.common.utility.SystemParameterChangeListener"> <property name="utility" ref="ent.systemParameterUtility" /> </bean> <!-- Proxy which listens for updates to SystemParameters within Hub --> <bean id="ent.hubSystemParameterChangeListener" class="org.springframework.jmx.access.MBeanProxyFactoryBean" depends-on="ent.serverConnector"> <property name="proxyInterface" value="javax.management.NotificationListener"/> <property name="server"> <bean class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean"> <property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:1098/entconnector"/> </bean> </property> <property name="connectOnStartup" value="true" /> </bean> <!-- Sets up RMI registry --> <bean id="ent.registry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"> <property name="port" value="1098"/> </bean> <!-- Exports MBean, registers it with MBeanServer and registers listeners --> <bean id="ent.exporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false" depends-on="ent.registry"> <property name="beans"> <map> <entry key="uk.co.web.services:type=SystemParameters" value-ref="ent.systemParametersService"/> </map> </property> <property name="registrationBehaviorName" value="REGISTRATION_FAIL_ON_EXISTING"/> <property name="assembler"> <bean class="org.springframework.jmx.export.assembler.MethodNameBasedMBeanInfoAssembler"> <property name="managedMethods"> <value>update</value> </property> </bean> </property> <property name="notificationListeners"> <list> <bean class="org.springframework.jmx.export.NotificationListenerBean"> <constructor-arg> <ref bean="ent.webSystemParameterChangeListener" /> </constructor-arg> <property name="mappedObjectNames"> <list> <value>uk.co.web.services:type=SystemParameters</value> </list> </property> </bean> <bean class="org.springframework.jmx.export.NotificationListenerBean"> <constructor-arg> <ref bean="ent.hubSystemParameterChangeListener" /> </constructor-arg> <property name="mappedObjectNames"> <list> <value>uk.co.web.services:type=SystemParameters</value> </list> </property> </bean> </list> </property> </bean> <!-- Exposes server-side connector --> <bean id="ent.serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean" depends-on="ent.registry"> <property name="objectName" value="connector:name=rmi"/> <property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:1098/entconnector"/> </bean>
I can see the beans and connector via JConsole and can see the notifications being published, but I get no reaction in the hub listener - can anybody help?Code:<bean id="ent.hubSystemParameterChangeListener" class="org.springframework.jmx.access.MBeanProxyFactoryBean" depends-on="ent.clientConnector" lazy-init="true"> <property name="proxyInterface" value="javax.management.NotificationListener"/> <property name="server" ref="ent.clientConnector"> </property> <property name="connectOnStartup" value="true" /> </bean> <!-- Client-side Connector --> <bean id="ent.clientConnector" class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean" lazy-init="true"> <property name="serviceUrl" value="service:jmx:rmi://localhost/jndi/rmi://localhost:1098/entconnector"/> </bean>


Reply With Quote