Bug #24602 ServerPreparedStatement.addBatch throws NullPointerException under Hibernate
Submitted: 26 Nov 2006 21:46 Modified: 21 Feb 2014 19:37
Reporter: [ name withheld ] Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.0.4 OS:MacOS (OSX)
Assigned to: Jess Balint CPU Architecture:Any
Tags: batch, hibernate, npe

[26 Nov 2006 21:46] [ name withheld ]
Description:
When using MySQL Connector/J for my database driver in JBoss 4.0.4 + Hibernate3.2 I get the following exception during an attempt to commit a batch update:

Exception in thread "main" java.rmi.ServerException: RuntimeException; nested exception is: 
	java.lang.NullPointerException
	at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:421)
	at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209)
	at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
	at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
	at org.jboss.ejb.Container.invoke(Container.java:954)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
	at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
	at sun.rmi.transport.Transport$1.run(Transport.java:153)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
	at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.NullPointerException
	at org.jboss.mx.loading.RepositoryClassLoader.findClass(RepositoryClassLoader.java:620)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:464)
	at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at com.mysql.jdbc.ServerPreparedStatement.addBatch(ServerPreparedStatement.java:348)
	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.addBatch(NewProxyPreparedStatement.java:131)
	at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:31)
	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2182)
	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2595)
	at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
	at edu.c410.parts.ejb.ProductManagerBean.orderProducts(ProductManagerBean.java:497)
	at edu.c410.parts.ejb.ProductManagerBean.orderProduct(ProductManagerBean.java:416)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
	at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
	at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
	at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
	at org.jboss.ws.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:64)
	at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
	at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
	at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
	at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
	at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
	at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
	... 25 more

How to repeat:
I can repeat this effortlessly with the same code.

The operations that take place are:

Create entity A
Create associated entity (to A) B1
Create associated entity (to A) B2
Create associated entity (to A) C (this is associated using only Hibernate, and not with a foreign key)

flush.
[1 Dec 2006 10:09] Tonci Grgin
Hi and thanks for your problem report.

Can you please provide me with complete Java-only test case (including DDL/DML statements) that shows this behavior every time?
[1 Dec 2006 14:00] [ name withheld ]
I would love to, however the error is extremely unreproducible (despite my belief otherwise when I submitted it).

It doesn't occur during the same operation all the time, nor does it occur outside of hibernate/JBoss environments.  It does not occur IN hibernate/JBoss environments using anything except the MySQL Connector/J driver.

Unfortunately, unless there's some idea from the stack trace, that's about the limit of what I'll be able to provide :/
[21 Feb 2014 19:11] Sveta Smirnova
Was "analyzed" by a person who doesn't work in the company anymore.