Description:
Error closing statement Caused by:
java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(EventObject.java:56)
at javax.sql.StatementEvent.<init>(StatementEvent.java:64)
at com.mysql.jdbc.jdbc2.optional.JDBC4PreparedStatementWrapper.close(JDBC4PreparedStatementWrapper.java:70)
at org.jboss.resource.adapter.jdbc.WrappedStatement.internalClose(WrappedStatement.java:881)
at org.jboss.resource.adapter.jdbc.WrappedStatement.close(WrappedStatement.java:79)
How to repeat:
A lot of places in my application shows this exception.
Suggested fix:
This issue happens in version 5.1.6 as described in bug 37645. I'm not sure whether it's broken again or not. Below are some comments I found from that bug:
Description:
Invocation of PreparedStatement.close() always causes IllegalArgumentException;
java.lang.IllegalArgumentException: null source
at java.util.EventObject.<init>(EventObject.java:38)
at javax.sql.StatementEvent.<init>(StatementEvent.java:39)
at
com.mysql.jdbc.jdbc2.optional.JDBC4PreparedStatementWrapper.close(JDBC4PreparedStatementWrapper.java:70)
The problem is pretty simple. JDBC4PreparedStatementWrapper.close() calls
StatementWrapper.close() where pooledConnection is set to null. Then
JDBC4PreparedStatementWrapper.close() tries to fire javax.sql.StatementEvent with null
PooledConnection as a parameter. It triggers the exception.
How to repeat:
Easy. Create a PreparedStatement and close it.