0

When i try to launch our java/hibernate/tomcat/postgres project, it crashes with null pointer exception in NewProxyDatabaseMetaData.detach() inside of c3p0 connection pool library:

private void detach()
{
    parentPooledConnection.removeConnectionEventListener( cel );
    parentPooledConnection = null;
}

parentPooledConnection is null

It happens on session factory initialization. The strange thing the same code works fine for other teammates.

I tried

  • reinstalled postgresql
  • updated jdbc driver
  • created brand new roles and databases

but no effect. Any ideas?

edit: i know 'what is a null pointer', but this is a crash inside of a connection pool library (c3p0) i don't control, i don't pass null object to the library, i am trying to initialize the hibernate session factory and somewhere deep inside hibernate and c3p0 something happens which closes the connection without parent pool connection.

Shpytyack Artem
  • 306
  • 2
  • 15
  • You can't call a method on a null object, it is what causes a NPE in the first place and looking at the code if its null already than there won't be any event listener to remove so you can just add a null check around the entire code block. – Ralph Ritoch Sep 15 '17 at 16:41
  • i know this, i edit the question so maybe it will be easier to understand it is not a regular null pointer exception in my code, but inside of a 3rd party library – Shpytyack Artem Sep 17 '17 at 06:36
  • Unfortunately if there is a NPE in a third party library your options are limited. Is it an open source library? If so just view the source and determine what is missing. If it is closed source than report the issue to the vendor. – Ralph Ritoch Sep 18 '17 at 19:20
  • I just posted hoping someone had the same exception at the same place and found the reason and could share it. – Shpytyack Artem Sep 19 '17 at 13:03

0 Answers0