[JAVA-641] JMX registration error Created: 12/Sep/12  Updated: 19/Mar/13  Resolved: 05/Mar/13

Status: Closed
Project: Java Driver
Component/s: Monitoring
Affects Version/s: 2.9.0
Fix Version/s: 2.9.2, 2.11.0

Type: Bug Priority: Major - P3
Reporter: Kay Agahd Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux 64 bit


Issue Links:
Depends
depends on JAVA-724 JMX MBean/MXBean fixes missing in lat... Closed
Related
is related to JAVA-666 Don't rely on MXBean Closed

 Description   

We are seeing the following error message in our Webserver (resin) log since we are using java driver 2.9.0:

[12-09-11 11:40:21.358] {main} jmx registration error: com.mongodb.util.management.JMException: javax.management.NotCompliantMBeanException: com.mongodb:type=ConnectionPool,host=sx177.ipx/172.x.x.x,port=27018,instance=1 mbean has no MBean interface for class com.mongodb.DBPortPool continuing... 

This error does not occur using java driver v2.7.3.

I found out that v2.7.3 uses SimplePool implementing DynamicMBean which v2.9.0 does not.
The problem is that resin (v4.0.30) checks wether the MBean is an instance of DynamicBean OR implements a MBeanInterface. The class name of the latter must end with the name of the implemented interface or superclass appended with MBean or MXBean.
The first is the case for v2.7.3 since SimplePool implements DynamicMBean. For v2.9.0 however, neither the first nor the latter is the case because it does not implement DynamicMBean anymore and the implemented interface com.mongodb.MongoConnectionPoolMXBean does not follow the naming convention. The interface name should end with DBPortPoolMBean or DBPortPoolMXBean or SimplePoolMBean or SimplePoolMXBean.



 Comments   
Comment by auto [ 08/Jan/13 ]

Author:

{u'date': u'2012-10-22T18:29:10Z', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-641: Updated exception error message for JMX registration to point people to MongoOptions.alwaysUseMBeans property
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/320b82dc497c605bae6328e51c97b11accad0551

Comment by auto [ 08/Jan/13 ]

Author:

{u'date': u'2012-10-21T03:25:18Z', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-641: Added MongoOptions property to control whether driver always uses MBeans. The default is false, in which case the driver will use MXBeans on Java 6 or greater
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/8d0e70409269be7142d43370bd3fd77af1bb6f41

Comment by auto [ 08/Jan/13 ]

Author:

{u'date': u'2012-10-19T14:00:09Z', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-666, JAVA-641: Created two subclasses of DBPortPool: MongoConnectionPool and Java5MongoConnectionPool. The former is an MBean and the latter is an MXBean. When creating a DBPortPool, conditionally create one or the other depending on whether java.version system property indicates that this is a 1.5 virtual machine. This should avoid JXM registration errors when running on Java 5 VMs. Also, by using MongoConnectionPool as the name of the MXBean, avoids incompatibilities in JMX implementations that require the MXBean name to be the same as the MXBean interface that it implements (minus the MXBean suffix).
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/2ee8c205515c4bec7c166ac1c13ab8c3ba220ac4

Comment by auto [ 08/Jan/13 ]

Author:

{u'date': u'2012-10-22T18:29:10Z', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-641: Updated exception error message for JMX registration to point people to MongoOptions.alwaysUseMBeans property
Branch: 2.10.x
https://github.com/mongodb/mongo-java-driver/commit/320b82dc497c605bae6328e51c97b11accad0551

Comment by auto [ 08/Jan/13 ]

Author:

{u'date': u'2012-10-21T03:25:18Z', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-641: Added MongoOptions property to control whether driver always uses MBeans. The default is false, in which case the driver will use MXBeans on Java 6 or greater
Branch: 2.10.x
https://github.com/mongodb/mongo-java-driver/commit/8d0e70409269be7142d43370bd3fd77af1bb6f41

Comment by auto [ 08/Jan/13 ]

Author:

{u'date': u'2012-10-19T14:00:09Z', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-666, JAVA-641: Created two subclasses of DBPortPool: MongoConnectionPool and Java5MongoConnectionPool. The former is an MBean and the latter is an MXBean. When creating a DBPortPool, conditionally create one or the other depending on whether java.version system property indicates that this is a 1.5 virtual machine. This should avoid JXM registration errors when running on Java 5 VMs. Also, by using MongoConnectionPool as the name of the MXBean, avoids incompatibilities in JMX implementations that require the MXBean name to be the same as the MXBean interface that it implements (minus the MXBean suffix).
Branch: 2.10.x
https://github.com/mongodb/mongo-java-driver/commit/2ee8c205515c4bec7c166ac1c13ab8c3ba220ac4

Comment by auto [ 22/Oct/12 ]

Author:

{u'date': u'2012-10-19T07:00:09-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-666, JAVA-641: Created two subclasses of DBPortPool: MongoConnectionPool and Java5MongoConnectionPool. The former is an MBean and the latter is an MXBean. When creating a DBPortPool, conditionally create one or the other depending on whether java.version system property indicates that this is a 1.5 virtual machine. This should avoid JXM registration errors when running on Java 5 VMs. Also, by using MongoConnectionPool as the name of the MXBean, avoids incompatibilities in JMX implementations that require the MXBean name to be the same as the MXBean interface that it implements (minus the MXBean suffix).
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/a215bdf4101033aac08aa72768a4bbe417e83402

Comment by auto [ 21/Oct/12 ]

Author:

{u'date': u'2012-10-20T20:25:18-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-641: Added MongoOptions property to control whether driver always uses MBeans. The default is false, in which case the driver will use MXBeans on Java 6 or greater
Branch: release-2.9.x
https://github.com/mongodb/mongo-java-driver/commit/8d0e70409269be7142d43370bd3fd77af1bb6f41

Comment by Jeffrey Yemin [ 21/Oct/12 ]

I tested with Jetty 6.1.10, JBoss 4.2.3 AS, and Resin 4.0.32, all under Java 6, using the recently committed code. None of them work the same.

  • Jetty 6.1.10: MongoConnectionPool MXBean works perfectly
  • JBoss 4.2.3: MongoConnectionPool MXBean doesn't work: "WARNING: jmx registration error: com.mongodb.util.management.JMException: javax.management.NotCompliantMBeanException: Class does not expose a management interface: java.lang.Object continuing..."
  • Resin 4.0.32: MongoConnectionPool MXBean partially works. The MXBean register, but the statistics property of type ConnectionPoolStatisticsBean is flagged as unavailable in jconsole.

Since the driver can't reliably detect the environment it's running in (except for java version), the only solution is to allow whether MBeans or MXBeans are used to be configured via a property in MongoOptions. I'm calling it "alwaysUseMBeans", and it defaults to false. For JBoss users running Java 6 or later, they should set this property to "true". Resin users can use either, but given the problem with the ConnectionPoolStatisticsBean type, "true" might also be a better option.

Comment by auto [ 20/Oct/12 ]

Author:

{u'date': u'2012-10-19T07:00:09-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-666, JAVA-641: Created two subclasses of DBPortPool: MongoConnectionPool and Java5MongoConnectionPool. The former is an MBean and the latter is an MXBean. When creating a DBPortPool, conditionally create one or the other depending on whether java.version system property indicates that this is a 1.5 virtual machine. This should avoid JXM registration errors when running on Java 5 VMs. Also, by using MongoConnectionPool as the name of the MXBean, avoids incompatibilities in JMX implementations that require the MXBean name to be the same as the MXBean interface that it implements (minus the MXBean suffix).
Branch: release-2.9.x
https://github.com/mongodb/mongo-java-driver/commit/2ee8c205515c4bec7c166ac1c13ab8c3ba220ac4

Comment by Jeffrey Yemin [ 16/Oct/12 ]

We're going to look to roll back this change. See JAVA-666.

Comment by Mark Cohen [ 16/Oct/12 ]

Jeff, we see the same issue with JBoss 4.2.3, FYI. We'll see if this is something that JBoss has taken care of in a later version. Would it make sense to start testing with more than just the Sun JMX provider to catch these kinds of issues?

thx

Comment by Jeffrey Yemin [ 16/Oct/12 ]

Raman, it's just monitoring.

Comment by Raman Yushkou [ 16/Oct/12 ]

How this issue affects driver behavior (does it critically influence on driver work or it's just a monitoring)?

Comment by Jeffrey Yemin [ 13/Sep/12 ]

Seems like an issue with CAPTCHA. I keep getting "Confirmation hash does not match. Please retry.".

Comment by Kay Agahd [ 13/Sep/12 ]

You couldn't sign up for a new account? It worked for me just some hours ago. Could you try again?

Comment by Jeffrey Yemin [ 13/Sep/12 ]

OK, thanks. Let me know what their response is. Resin's Mantis bug tracking system is not letting me sign up for a new account.

Comment by Kay Agahd [ 13/Sep/12 ]

Yes, I just submitted a bug report:
http://bugs.caucho.com/view.php?id=5212

Comment by Jeffrey Yemin [ 13/Sep/12 ]

I'd rather fix Resin, since the bug is theirs and it's going to cause problems for other JMX clients. Have you tried their support forums?

Comment by Kay Agahd [ 13/Sep/12 ]

You are right, other application servers, as for example Glassfish too, don't throw any jmx registration errors.
However, Resin does and I'm wondering whether it's better to fix resin or the mongo driver.
What do you think?

Comment by Jeffrey Yemin [ 12/Sep/12 ]

According to http://docs.oracle.com/javase/6/docs/api/javax/management/MXBean.html:

  • Otherwise, it may be an MXBean. The set of interfaces implemented by the object is examined for interfaces that:
    • have a class name SMXBean where S is any non-empty string, and do not have an annotation @MXBean(false); and/or
    • have an annotation @MXBean(true) or just @MXBean.

And I don't see any problems registering this MXBean with Sun's JMX provider. So this may be a problem with the JMX provider used in Resin.

Comment by Kay Agahd [ 12/Sep/12 ]

The same applies to v2.9.1

Generated at Thu Feb 08 08:52:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.