Subject Null pointer exception in JDBC call to getWarnings
Author Kenneth Foo
Here is my log output with the stack trace.
Going through the code visually, it seems to me that
FBManagedConnection.getWarnings() is referencing to a null
"currentDbHandle" instance.

The code that hibernate calls is something like this, which seems to test to
see if the connection is open to actually
call getWarnings().

public void closeConnection(Connection conn) throws HibernateException {
try {
if ( !conn.isClosed() ) {
try {
JDBCExceptionReporter.logWarnings( conn.getWarnings() ); \
conn.clearWarnings();
}
catch (SQLException sqle) {
//workaround for WebLogic
log.debug("could not log warnings", sqle);
}
}
factory.getConnectionProvider().closeConnection(conn);
}
catch (SQLException sqle) {
throw new JDBCException("Cannot close connection", sqle);
}
}


Seems perfectly alright on hibernate side.
Anybody encountered this problem before? Is this a bug in the jdbc driver?

Thanks!

Regards
kenneth

PS: Stack trace below & log output below

Hibernate: select memberbase0_.ID as ID0_, memberbase0_.DOMAIN_ID as
DOMAIN_ID0_, memberbase0_.PARENT_ID as PARENT_ID0_, memberbase0_.NAME as
NAME0_, memberbase0_.BASE_TYPE as BASE_TYPE0_, memberbase0_.CONNECTOR_TYPE
as CONNECTO6_0_, memberbase0_.TABLE_NAME as TABLE_NAME0_,
memberbase0_.PK_FIELD as PK_FIELD0_, memberbase0_.DESCRIPTION as
DESCRIPT9_0_, memberbase0_.SCOPE as SCOPE0_, memberbase0_.INHERITANCE as
INHERIT11_0_, memberbase0_.FILTERS_DEF as FILTERS12_0_,
memberbase0_.PROPERTIES as PROPERTIES0_, memberbase0_.CREATE_TIME as
CREATE_14_0_ from MEMBERBASES memberbase0_ where memberbase0_.ID=?
Hibernate: select fields0_.FIELD_NAME as FIELD_NAME__, fields0_.FIELD_TYPE
as FIELD_TYPE__, fields0_.FIELD_ROLE as FIELD_ROLE__, fields0_.FIELD_ALIASES
as FIELD_AL5___, fields0_.MEMBERBASE_ID as MEMBERBA1___ from
MEMBERBASE_FIELDS fields0_ where fields0_.MEMBERBASE_ID=?
Hibernate: delete from MEMBERBASE_FIELDS where MEMBERBASE_ID=? and
FIELD_NAME=? and FIELD_TYPE=? and FIELD_ROLE=? and FIELD_ALIASES=?

2004-04-14 12:00:23,234 ERROR [TP-Processor3] (MemberbaseDAO.java:123) -
java.lang.NullPointerException
java.lang.NullPointerException
at
org.firebirdsql.jca.FBManagedConnection.getWarnings(FBManagedConnection.java:1046)
at
org.firebirdsql.jdbc.AbstractConnection.getIscWarnings(AbstractConnection.java:858)
at
org.firebirdsql.jdbc.AbstractConnection.getWarnings(AbstractConnection.java:574)
at net.sf.hibernate.impl.BatcherImpl.closeConnection(BatcherImpl.java:289)
at net.sf.hibernate.impl.SessionImpl.disconnect(SessionImpl.java:3310)
at net.sf.hibernate.impl.SessionImpl.close(SessionImpl.java:552)
at
org.springframework.orm.hibernate.SessionFactoryUtils.closeSessionIfNecessary(SessionFactoryUtils.java:192)
at
org.springframework.orm.hibernate.HibernateTransactionManager.doCleanupAfterCompletion(HibernateTransactionManager.java:431)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:467)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:331)
at
com.nic.interx.webapp.component.DBController.commit(DBController.java:78)
at
com.nic.interx.webapp.component.memberbase.MemberbaseDAO.updateData(MemberbaseDAO.java:118)
at
com.nic.interx.webapp.component.memberbase.MemberbaseEditPanel.updateData(MemberbaseEditPanel.java:487)
at
com.nic.interx.webapp.component.memberbase.MemberbaseEditPanel.finish(MemberbaseEditPanel.java:263)
at
com.nic.interx.webapp.component.memberbase.MemberbaseEditPanel.access$3(MemberbaseEditPanel.java:245)
at
com.nic.interx.webapp.component.memberbase.MemberbaseEditPanel$7.actionPerformed(MemberbaseEditPanel.java:459)
at nextapp.echo.AbstractButton.fireActionPerformed(AbstractButton.java:268)
at
nextapp.echo.AbstractButton$EventForwarder.actionPerformed(AbstractButton.java:127)
at
nextapp.echo.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:88)
at nextapp.echo.DefaultButtonModel.doAction(DefaultButtonModel.java:77)
at nextapp.echo.AbstractButton.doAction(AbstractButton.java:238)
at
nextapp.echoservlet.ui.AbstractButtonUI.clientAction(AbstractButtonUI.java:76)
at echopoint.ui.PushButtonUI.clientAction(PushButtonUI.java:84)
at
nextapp.echoservlet.ControllerInputProcessor.doAction(ControllerInputProcessor.java:144)
at
nextapp.echoservlet.ControllerInputProcessor.<init>(ControllerInputProcessor.java:113)
at
nextapp.echoservlet.ControllerInputProcessor.process(ControllerInputProcessor.java:44)
at nextapp.echoservlet.Controller.service(Controller.java:585)
at nextapp.echoservlet.Connection.process(Connection.java:441)
at nextapp.echoservlet.EchoServer.process(EchoServer.java:303)
at nextapp.echoservlet.EchoServer.doPost(EchoServer.java:223)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
at java.lang.Thread.run(Unknown Source)