javax.management.InstanceAlreadyExistsException: org.mongodb.driver:type=ConnectionPool,clusterId=3,host=localhost,port=27017

JIRA | Alexej Kubarev | 3 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    When running several WAR files under one appserver, and both WAR files create one or several MongoClient instances, with 2.12.0-rc0 we start seeing {code} WARNING: Unable to register MBean org.mongodb.driver:type=ConnectionPool,clusterId=3,host=localhost,port=27017 javax.management.InstanceAlreadyExistsException: org.mongodb.driver:type=ConnectionPool,clusterId=3,host=localhost,port=27017 at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324) at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522) at com.mongodb.util.management.jmx.JMXMBeanServer.registerMBean(JMXMBeanServer.java:59) at com.mongodb.JMXConnectionPoolListener.connectionPoolOpened(JMXConnectionPoolListener.java:52) at com.mongodb.PooledConnectionProvider.<init>(PooledConnectionProvider.java:60) at com.mongodb.DefaultClusterableServerFactory.create(DefaultClusterableServerFactory.java:50) at com.mongodb.BaseCluster.createServer(BaseCluster.java:202) at com.mongodb.SingleServerCluster.<init>(SingleServerCluster.java:45) at com.mongodb.Clusters.create(Clusters.java:37) at com.mongodb.DBTCPConnector.start(DBTCPConnector.java:75) at com.mongodb.Mongo.<init>(Mongo.java:346) at com.mongodb.Mongo.<init>(Mongo.java:327) at com.mongodb.MongoClient.<init>(MongoClient.java:268) at com.mongodb.Mongo$Holder.connect(Mongo.java:782) {code} This happens for the second WAR file starting (first one works fine, even though it started several instances of MongoClient). If we load only one of the WAR files (no matter which) this does not happen. This is working fine if using 2.11.4 (and a few earlier versions, for sure) of the driver but broke in 2.12.0-rc0

    JIRA | 3 years ago | Alexej Kubarev
    javax.management.InstanceAlreadyExistsException: org.mongodb.driver:type=ConnectionPool,clusterId=3,host=localhost,port=27017
  2. 0

    GitHub comment 114#242338166

    GitHub | 7 months ago | gquintana
    javax.management.InstanceAlreadyExistsException: kafka.consumer:type=app-info,id=logstash
  3. 0

    Getting exception while refreshing Spring ApplicationContext in Spring Boot application

    Stack Overflow | 2 years ago | user1514499
    org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [org.springframework.integration.monitor.IntegrationMBeanExporter@16c5464] with key 'integrationMbeanExporter'; nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.integration.monitor:name=integrationMbeanExporter,type=IntegrationMBeanExporter
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 227#163426201

    GitHub | 1 year ago | TabberGit
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springApplicationAdminRegistrar' defined in class path resource [org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Admin,name=SpringApplication
  6. 0

    Developer tools: problems reloading context

    GitHub | 2 years ago | dsyer
    java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. javax.management.InstanceAlreadyExistsException

    org.mongodb.driver:type=ConnectionPool,clusterId=3,host=localhost,port=27017

    at com.sun.jmx.mbeanserver.Repository.addMBean()
  2. Java RT
    JmxMBeanServer.registerMBean
    1. com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
    2. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
    3. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
    4. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
    5. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
    6. com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
    6 frames
  3. org.eclipse.orbit.mongodb_2.10.1.v20130422-1135.jar
    JMXMBeanServer.registerMBean
    1. com.mongodb.util.management.jmx.JMXMBeanServer.registerMBean(JMXMBeanServer.java:59)
    1 frame
  4. MongoDB Java Driver
    Mongo$Holder.connect
    1. com.mongodb.JMXConnectionPoolListener.connectionPoolOpened(JMXConnectionPoolListener.java:52)
    2. com.mongodb.PooledConnectionProvider.<init>(PooledConnectionProvider.java:60)
    3. com.mongodb.DefaultClusterableServerFactory.create(DefaultClusterableServerFactory.java:50)
    4. com.mongodb.BaseCluster.createServer(BaseCluster.java:202)
    5. com.mongodb.SingleServerCluster.<init>(SingleServerCluster.java:45)
    6. com.mongodb.Clusters.create(Clusters.java:37)
    7. com.mongodb.DBTCPConnector.start(DBTCPConnector.java:75)
    8. com.mongodb.Mongo.<init>(Mongo.java:346)
    9. com.mongodb.Mongo.<init>(Mongo.java:327)
    10. com.mongodb.MongoClient.<init>(MongoClient.java:268)
    11. com.mongodb.Mongo$Holder.connect(Mongo.java:782)
    11 frames