NPE with MySQL PreparedStatement
--------------------------------
Key: DBCP-335
URL: https://issues.apache.org/jira/browse/DBCP-335
Project: Commons Dbcp
Issue Type: Bug
Affects Versions: 1.4
Environment: CloudFoundry, Linux, Sun Java 1.6.0_04, Grails 1.2.2,
MySQL Connector 5.1.12
Reporter: Marcus Better
My Grails application using MySQL and DBCP often throws an exception as below.
I can trigger it by making a simultaneous requests (three at a time) on
differend threads in a ThreadPoolExecutor. The requests would all use the same
query. This triggers the exception with a few percent probability.
I have tried with DBCP 1.2.2 and 1.4.
There is a similar-looking [MySQL bug|http://bugs.mysql.com/bug.php?id=41628]
but they blame the pool...
{code}
Exception in thread "pool-1-thread-12" java.lang.NullPointerException
at
com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2475)
at
com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2451)
at
com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2205)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at
org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1881)
at
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:71)
at
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:65)
at
org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3072)
at
org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:434)
at
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:415)
at
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:165)
at
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:121)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:863)
at
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:95)
at
org.codehaus.groovy.grails.orm.hibernate.proxy.HibernateProxyHandler.unwrapProxy(HibernateProxyHandler.java:80)
at
org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsHibernateUtil.unwrapProxy(GrailsHibernateUtil.java:322)
at
org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsHibernateUtil$unwrapProxy.call(Unknown
Source)
at
org.codehaus.groovy.grails.plugins.orm.hibernate.HibernatePluginSupport$__clinit__closure88.doCall(HibernatePluginSupport.groovy:401)
at sun.reflect.GeneratedMethodAccessor381.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:266)
at
org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:51)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151)
at
org.codehaus.groovy.grails.plugins.orm.hibernate.HibernatePluginSupport$__clinit__closure88.call(HibernatePluginSupport.groovy)
at sun.reflect.GeneratedMethodAccessor380.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1049)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:923)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:880)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:924)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:923)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:880)
at
org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:739)
at
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:722)
at
org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod$1.invoke(ClosureMetaMethod.java:135)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1594)
at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:951)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3287)
at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:964)
at
org.codehaus.groovy.runtime.callsite.PogoMetaClassGetPropertySite.getProperty(PogoMetaClassGetPropertySite.java:48)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:241)
at org.example.MyService.onApplicationEvent(MyService.groovy:52)
at org.example.MyService.onApplicationEvent(MyService.groovy)
at
org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:92)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.