Bug #13469 log4J incompatibility: class: com/mysql/jdbc/log/Log4JLogger, method: isFatalEn
Submitted: 25 Sep 2005 15:13 Modified: 7 Apr 2006 21:37
Reporter: Ralf Hauser Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:mysql-connector-java-3.1-nightly-2005092 OS:Microsoft Windows (windows XP)
Assigned to: Mark Matthews

[25 Sep 2005 15:13] Ralf Hauser
Description:
Hi,

The reason for the following error may be that I use log4j-1.3alpha-6.jar together with mysql-connector-java-3.1-nightly-20050925-bin-g.jar

java.lang.VerifyError: (class: com/mysql/jdbc/log/Log4JLogger, method: isFatalEnabled signature: ()Z) Incompatible argument to function
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:164)
	at com.mysql.jdbc.log.LogFactory.getLogger(LogFactory.java:68)
	at com.mysql.jdbc.Connection.initializeDriverProperties(Connection.java:3624)
	at com.mysql.jdbc.Connection.<init>(Connection.java:1471)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:264)
	at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
	at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
	at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)

How to repeat:
it appears that the error is not reproducible with mysql-connector-java-3.1-nightly-20050925-bin.jar
[25 Sep 2005 15:19] Ralf Hauser
oops, I have to correct, it also happens with
  mysql-connector-java-3.1-nightly-20050925-bin.jar
but it does not happen with mysql-connector-java-3.1.9-bin.jar
[25 Sep 2005 19:29] Mark Matthews
At this time, we support production versions of Log4j, not alpha releases.

We'll revisit fixing this for the latest version of log4j _when_it_ships_.

A workaround would be to create your own log factory, and then you would be able to work with their new API.
[26 Sep 2005 5:54] Ralf Hauser
that's certainly reasonable and going back to 1.2.12 fixes it for now.

But if you touch this next time, I suggest you go for commons-logging instead of log4j - if that had been done, I wouldn't have run into the error because I use a commons-logging.jar version that can handle the log4j-1.3*
[24 Dec 2005 16:41] Tom Donovan
This bug also prevents using Connector/J versions higher than 3.1.9 with any legacy applications that embed older log4j versions, like v1.1.3.
[6 Jan 2006 13:04] Ricardo Trindade
I tried to add this to the jdbc URL : ?logger=com.mysql.jdbc.log.StandardLogger,
but the problem still occurs (connector/J 5, log4j 1.3-alpha7)

Since I'm specifying a different logger, not log4j, why does the problem still occur ? Why is the mysql log4j logger even loaded ?

thanks
Ricardo
[17 Feb 2006 18:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/2814
[2 Mar 2006 16:29] Eric Martineau
"A workaround would be to create your own log factory, and then you would be able
to work with their new API."

Can someone elaborate briefly on how this is done, or where documentation can be found on how to do it?

Thanks
[2 Mar 2006 16:34] Mark Matthews
Actually if you look at the nightly snapshots of 3.1 or 5.0, you'll see we've added "CommonsLogger" as a log factory, so you _can_ use Jakarta Commons if you want.

(or look at any of the *Logger classes in com.mysql.jdbc.log to see how it's done)
[3 Mar 2006 15:24] Jean-Fran├žois THAMIE
I had the same problem with log4j 1.3alpha-7. I've just downloaded the 1.3alpha-8 and it solved my problem.
http://cvs.apache.org/dist/logging/log4j/1.3alpha-8/logging-log4j-1.3alpha-8.zip

Jeff
[7 Apr 2006 21:37] Mark Matthews
We actually ended up removing autodetection of Log4j, as it was too problematic. See the CHANGES for 3.1.13 or 5.0.1 when released for details, or look at the link to the changeset listed in this bug report.

This fix is in the nightly builds available at http://downloads.mysql.com/snapshots.php#connector-j
[3 Mar 2008 1:20] kenia moyano
hola