Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WARNING: Error while registering Oracle JDBC Diagnosability MBean

We are getting the following error when using Oracle 11g ojdbc6.jar:

WARNING: Error while registering Oracle JDBC Diagnosability MBean.
java.lang.NoSuchMethodError:
javax.management.StandardMBean.<init>(Ljava/lang/Class;Z)V
        at oracle.jdbc.driver.OracleDiagnosabilityMBean.<init>(OracleDiagnosabilityMBean.java:34)
        at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:342)
        at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:199)

After investigating from many forums and blogs, we have not found any final solutions yet. So, we want to share the workaround way here.

like image 484
totolearning Avatar asked Mar 04 '11 07:03

totolearning


1 Answers

According Oracle document, The JDBC diagnosability management feature introduces an MBean, oracle.jdbc.driver.OracleDiagnosabilityMBean. This MBean provides means to enable and disable JDBC logging, you can find it here: https://docs.oracle.com/cd/B28359_01/java.111/b31224/diagnose.htm.

And, the driver uses java.util.logging for logging purpose, actually in our cases we don't really need to use that info, so decide to disable the log and there is NO warning happen anymore.

How to disable the log for the driver (oracle.jdbc):

  • As default, JRE use the default properties file in JRE_HOME\lib\logging.properties, so edit the file and adding this info:
    • oracle.jdbc.level=OFF
  • Or configuring your own properties log file for java.util.logging
    • java -Djava.util.logging.config.file=/YourConfig.properties
    • Add oracle.jdbc.level=OFF to YourConfig.properties

It works for us, don't get any WANRING error above.

like image 60
totolearning Avatar answered Nov 14 '22 21:11

totolearning