| Bug #8498 | ExceptionInInitializerError | ||
|---|---|---|---|
| Submitted: | 14 Feb 2005 13:57 | Modified: | 14 Feb 2005 15:22 |
| Reporter: | Francois Guillemette | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S1 (Critical) |
| Version: | 3.1.16 | OS: | Windows (Windows XP SP2) |
| Assigned to: | CPU Architecture: | Any | |
[14 Feb 2005 15:19]
Mark Matthews
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.
If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information
about accessing the source trees is available at
http://www.mysql.com/doc/en/Installing_source_tree.html
[14 Feb 2005 15:22]
Mark Matthews
This was a known issue, which was already fixed for 3.1.7. You can test it via a nightly snapshot from http://downloads.mysql.com/snapshots.php#connector-j

Description: java.lang.ExceptionInInitializerError at com.mysql.jdbc.SQLError.<clinit>(SQLError.java:89) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2834) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1625) at com.mysql.jdbc.Connection.execSQL(Connection.java:2291) at com.mysql.jdbc.Connection.execSQL(Connection.java:2226) at com.mysql.jdbc.Statement.executeQuery(Statement.java:1159) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:162) at org.apache.commons.dbcp.PoolableConnectionFactory.validateObject(PoolableConnectionFactory.java:221) at org.apache.commons.pool.impl.GenericObjectPool.returnObject(Unknown Source) ... Caused by: java.lang.NullPointerException at com.mysql.jdbc.Messages.getString(Messages.java:70) at com.mysql.jdbc.Util.stackTraceToString(Util.java:118) at com.mysql.jdbc.Messages.<clinit>(Messages.java:50) ... 48 more I'm using Java 1.4.1_06, Tomcat 4.0. The Message.class.getClassLoader() method may return null. (Javadoc for getClassLoader() : Some implementations may use null to represent the bootstrap class loader.). The method getBundle() of ResourceBundle class must not have any null value for parameter. How to repeat: Use an implementation that return null when calling the method getClassLoader(). Suggested fix: static { try { ClassLoader cl = Messages.class.getClassLoader(); if (cl != null) { RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault(), cl); } else { RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault()); } } catch (Throwable t) { throw new RuntimeException("Can't load resource bundle due to underlying exception " + t.toString() + "\n\nStack Tace:\n\n" + Util.stackTraceToString(t)); } }