Already Registered bean when redeploying

View: New views
1 Messages — Rating Filter:   Alert me  

Already Registered bean when redeploying

by Sugra Llistaire :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi all,

when I redeploy my war (touch web.xml), running on JBoss  I get an
Exception about my MBean

The line that crashes is :
ApplicationContext context = new
ClassPathXmlApplicationContext("appConfig.xml");

My MBean is declared as:
public class ConfigManager extends org.jboss.system.ServiceMBeanSupport
implements ConfigManagerMBean{

At the beginning, everything goes fine and I can check the data at
http://localhost:8080/jmx-console, but, when I touch my web.xml I get
the stack below, claiming the bean is already registered (sure it's been).
After this error, I can check my data again in jmx-console, but i cannot
retrieve them from my java code.
I wonder if there is a way to avoid this Exception or, instead, check if
the bean has been loaded and retrieve the class using other methods.


2008-09-17 10:16:32,471 ERROR [com.sugra.portal.Run] Registering Beans
JMX : org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'ConfigManagerExporter' defined in class path
resource [appConfig.xml]: Invocation of init method failed; nested
exception is
org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to
register MBean [com.sugra.inicialitzacio.ConfigManager@1b2f0c7] with key
'jboss:service=ConfigManagerbean'; nested exception is
javax.management.InstanceAlreadyExistsException:
jboss:service=ConfigManagerbean already registered. at
(BasicMBeanRegistry.java:761
2008-09-17 10:16:32,472 DEBUG [com.sugra.portal.Run]
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'ConfigManagerExporter' defined in class path resource
[appConfig.xml]: Invocation of init method failed; nested exception is
org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to
register MBean [com.sugra.inicialitzacio.ConfigManager@1b2f0c7] with key
'jboss:service=ConfigManagerbean'; nested exception is
javax.management.InstanceAlreadyExistsException:
jboss:service=ConfigManagerbean already registered.
Caused by:
org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to
register MBean [com.sugra.inicialitzacio.ConfigManager@1b2f0c7] with key
'jboss:service=ConfigManagerbean'; nested exception is
javax.management.InstanceAlreadyExistsException:
jboss:service=ConfigManagerbean already registered.
Caused by: javax.management.InstanceAlreadyExistsException:
jboss:service=ConfigManagerbean already registered.
   at
org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:761)

   at
org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:225)

   at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
   at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

   at java.lang.reflect.Method.invoke(Method.java:597)
   at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)

   at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
   at
org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)

   at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
   at
org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)

   at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
   at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
   at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1422)
   at java.security.AccessController.doPrivileged(Native Method)
   at
org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1417)

   at
org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:376)
   at
org.springframework.jmx.support.MBeanRegistrationSupport.doRegister(MBeanRegistrationSupport.java:162)

   at
org.springframework.jmx.export.MBeanExporter.registerBeanInstance(MBeanExporter.java:589)

   at
org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:565)

   at
org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:494)

   at
org.springframework.jmx.export.MBeanExporter.afterPropertiesSet(MBeanExporter.java:388)

   at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1201)

   at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)

   at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)

   at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)

   at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)

   at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)

   at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)

   at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)

   at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)

   at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:126)

   at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:106)

   at com.sugra.portal.Run.initBeansJMX(Run.java:80)



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Springframework-user mailing list
Springframework-user@...
https://lists.sourceforge.net/lists/listinfo/springframework-user
LightInTheBox - Buy quality products at wholesale price!