ArrayIndexOutOfBoundsException problems
Posted by: Jonathan Gordon
Date: February 01, 2005 04:57PM

I'm having intermittent problems with Connector/J when I stress test my web application using connection pooling (c9p0). The main exception I receive is an ArrayIndexOutOfBoundsException.

I'm using MySQL server on Linux: mysql Ver 14.7 Distrib 4.1.8, for pc-linux (i686)
Connector/J on Windows: mysql-connector-java-3.1.6
JDK:
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

Here's the stack trace:

-- BEGIN STACK TRACE --
Caused by: java.sql.SQLException: java.lang.ArrayIndexOutOfBoundsException: 82
at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:994)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1657)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:71)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:83)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:794)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:188)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:132)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:830)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:850)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:420)
... 58 more
-- END STACK TRACE --

Additionally, I will sometimes get this exception:

-- BEGIN STACK TRACE --
java.sql.SQLException: Unknown character set index for field '24393' received from server.
at com.mysql.jdbc.Connection.getCharsetNameForIndex(Connection.java:1598)
at com.mysql.jdbc.Field.<init>(Field.java:166)
at com.mysql.jdbc.MysqlIO.unpackField(MysqlIO.java:625)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:403)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:1902)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1350)
at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1390)
at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:957)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1657)
at com.p6spy.engine.logging.P6LogPreparedStatement.executeQuery(P6LogPreparedStatement.java:172)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:71)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:83)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:794)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:188)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:132)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:830)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:850)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:420)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2044)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1918)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1880)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:68)
at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:215)
at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:154)
at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:71)
at net.sf.hibernate.impl.IteratorImpl.next(IteratorImpl.java:91)

-- END STACK TRACE --

Examining the source for com.mysql.jdbc.Connection at the first line of the exception:
at com.mysql.jdbc.Connection.getCharsetNameForIndex(Connection.java:1598)

shows that the SQLException is thrown when another ArrayIndexOutOfBoundsException is encountered.

Any idea of what could be causing these problems? I saw an earlier post saying this problem was fixed moving from 3.0.16 to 3.1.16 but that doesn't appear to be the case in my instance.

Thanks,

Jonathan.

Options: ReplyQuote


Subject
Written By
Posted
ArrayIndexOutOfBoundsException problems
February 01, 2005 04:57PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.