PDA

View Full Version : unregister JMX bean fails on redeployment


mroosendaal
Apr 4th, 2006, 03:04 AM
Hi,

I have an EAR-file which contains a .sar file that starts the Spring context. It contains a JMX bean defined as:
<!-- ********************* JMX Configuration for Spring ************************ -->
<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="bean:name=LO3IDVProcess" value-ref="lo3idvmbean"/>
</map>
</property>
<property name="assembler">
<bean class="org.springframework.jmx.export.assembler.MethodNam eBasedMBeanInfoAssembler">
<property name="managedMethods">
<value>stopIDVPRocessing,startIDVPRocessing,isRunning</value>
</property>
</bean>
</property>
</bean>

<bean id="lo3idvmbean" class="nl.ictu.spg.integration.idvmessageprocessing.jmx.L O3IDVBackgroundMBean">
</bean>

The first time the Spring context is initlized fine but when i hotredeploy (on JBoss 4.0.2) i get:
08:56:22,261 INFO [DefaultListableBeanFactory] Creating shared instance of singleton bean 'lo3idvmbean'
08:56:22,292 INFO [MBeanExporter] Unregistering JMX-exposed beans on shutdown
08:56:22,292 INFO [DefaultListableBeanFactory] Destroying singletons in factory {org.springframework.beans.factory.support.Default ListableBeanFactory
defining beans [dataSource,sessionFactory,SystemProperties,transac tionManager,abstractTxDefinition,BaseTableDAOTarge t,BaseTableDAO,LO3PLDAOTarget,LO3
PLDAO,WorkflowDAOTarget,WorkflowDAO,dao,pldao,LO3B erichtDAOTarget,LO3BerichtDAO,USI,messagesender,jm sTemplate,jmsConnectionFactory,exporter,lo3idvmbea
n]; root of BeanFactory hierarchy}
08:56:22,308 INFO [LocalSessionFactoryBean] Closing Hibernate SessionFactory
08:56:22,308 INFO [SessionFactoryImpl] closing
08:56:22,308 ERROR [SpgServiceLocator] Error initializing Spring ApplicationContext
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'exporter' defined in class path resource [config/applicationCo
ntext-ejb.xml]: Initialization of bean failed; nested exception is javax.management.InstanceAlreadyExistsException: bean:name=LO3IDVProcess already re
gistered.
javax.management.InstanceAlreadyExistsException: bean:name=LO3IDVProcess already registered.
at org.jboss.mx.server.registry.BasicMBeanRegistry.ad d(BasicMBeanRegistry.java:755)
at org.jboss.mx.server.registry.BasicMBeanRegistry.re gisterMBean(BasicMBeanRegistry.java:211)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknow n Source)

I can see my EJB being removed but why isn't the jmx bean removed? Does anyone know howto do this.

thanks,
Maarten

Costin Leau
Apr 7th, 2006, 06:36 AM
The exporter seems to properly call the unregister method. Can you turn on logging in jboss also to see what happens after the exporter tries to unregister the beans?

mroosendaal
Apr 7th, 2006, 08:56 AM
Thanks for the response. Due to time-constraint i had to come up with something else. I use a regular ServiceMBean (using HASingletonSupport-class from JBoss) now which gets deployed and undeployed in a cluster without a problem.

Costin Leau
Apr 7th, 2006, 09:28 AM
To avoid such problems in the future please raise an issue on jira and add upload some tests if you have. Thanks.