javax.management.InstanceAlreadyExistsException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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
    via by Alexej Kubarev,
  • GitHub comment 114#242338166
    via GitHub by gquintana
    ,
  • GitHub comment 227#163426201
    via GitHub by TabberGit
    ,
    • 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)

    Users with the same issue

    Unknown visitor1 times, last one,
    batwalrus76
    1247 times, last one,
    Handemelindo
    3 times, last one,
    kjhdofjosvs
    3 times, last one,
    tvrmsmith
    2 times, last one,
    24 more bugmates