Results 1 to 2 of 2

Thread: javax.management.InstanceAlreadyExistsException

  1. #1
    Join Date
    Jul 2008
    Posts
    27

    Default javax.management.InstanceAlreadyExistsException

    I was trying configure JMX for a test job and was very closely following the adhoc job sample (the relevant part of the application context is basically just the contents of the adhoc-job-launcher-context.xml with a different service URL) and get the following exception:

    Code:
    Exception in thread "Thread-3" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverConnector' defined in class path resource [remote-launcher-context.xml]: Invocation of init method failed; nested exception is javax.management.InstanceAlreadyExistsException: connector:name=rmi
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    	at org.springframework.batch.sample.launch.TaskExecutorLauncher.run(TaskExecutorLauncher.java:124)
    	at org.springframework.batch.sample.launch.TaskExecutorLauncher.access$0(TaskExecutorLauncher.java:118)
    	at org.springframework.batch.sample.launch.TaskExecutorLauncher$1.run(TaskExecutorLauncher.java:95)
    	at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.management.InstanceAlreadyExistsException: connector:name=rmi
    	at com.sun.jmx.mbeanserver.RepositorySupport.addMBean(RepositorySupport.java:452)
    	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1410)
    	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:936)
    	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:337)
    	at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:497)
    	at org.springframework.jmx.support.MBeanRegistrationSupport.doRegister(MBeanRegistrationSupport.java:171)
    	at org.springframework.jmx.support.ConnectorServerFactoryBean.afterPropertiesSet(ConnectorServerFactoryBean.java:145)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
    	... 18 more
    Is this a common problem? Has anyone experienced something like that?

    The adhoc job sample worked earlier when I was using it with another Eclipse workspace.

  2. #2
    Join Date
    Jul 2008
    Posts
    27

    Default

    Found it, the application context was accidentally loaded a second time in an older fragment of my test code.

Posting Permissions

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