Skip to main content

I am using JDBC to communicate with Relativity and it seems to work well most of the time but intermittently, seemingly at random, I get the following exception:

java.lang.NullPointerException
      at relativity.jdbc.RPCInterface.SQLFreeStmtSP(Unknown Source)
      at relativity.jdbc.RelativityResultSet.close(Unknown Source)
      at relativity.jdbc.RelativityResultSet.finalize(Unknown Source)
      at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
      at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
      at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)

There seems to be no pattern to when this exception will occur and it seems to occur completely independently of any task that is being performed. I have tried to catch the exception anywhere in the application where I am using a ResultSet but have not yet been able to catch it.

Has anyone had similar problems before?

I am using JDBC to communicate with Relativity and it seems to work well most of the time but intermittently, seemingly at random, I get the following exception:

java.lang.NullPointerException
      at relativity.jdbc.RPCInterface.SQLFreeStmtSP(Unknown Source)
      at relativity.jdbc.RelativityResultSet.close(Unknown Source)
      at relativity.jdbc.RelativityResultSet.finalize(Unknown Source)
      at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
      at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
      at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)

There seems to be no pattern to when this exception will occur and it seems to occur completely independently of any task that is being performed. I have tried to catch the exception anywhere in the application where I am using a ResultSet but have not yet been able to catch it.

Has anyone had similar problems before?

Is it always in SQLFreeStmtSP?

Tom Morrison
Hill Country Software


I am using JDBC to communicate with Relativity and it seems to work well most of the time but intermittently, seemingly at random, I get the following exception:

java.lang.NullPointerException
      at relativity.jdbc.RPCInterface.SQLFreeStmtSP(Unknown Source)
      at relativity.jdbc.RelativityResultSet.close(Unknown Source)
      at relativity.jdbc.RelativityResultSet.finalize(Unknown Source)
      at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
      at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
      at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)

There seems to be no pattern to when this exception will occur and it seems to occur completely independently of any task that is being performed. I have tried to catch the exception anywhere in the application where I am using a ResultSet but have not yet been able to catch it.

Has anyone had similar problems before?

Yes. It is always in the same method, however sometimes the stack trace is slightly different as below:

java.lang.NullPointerException

at relativity.jdbc.RPCInterface.SQLFreeStmtSP(Unknown Source)

at relativity.jdbc.RelativityResultSet.close(Unknown Source)

at relativity.jdbc.RelativityStatement.close(Unknown Source)

at relativity.jdbc.RelativityPreparedStatement.close(Unknown Source)

at relativity.jdbc.RelativityStatement.finalize(Unknown Source)

at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)

at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)

at java.lang.ref.Finalizer.access$100(Finalizer.java:32)

at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)


I am using JDBC to communicate with Relativity and it seems to work well most of the time but intermittently, seemingly at random, I get the following exception:

java.lang.NullPointerException
      at relativity.jdbc.RPCInterface.SQLFreeStmtSP(Unknown Source)
      at relativity.jdbc.RelativityResultSet.close(Unknown Source)
      at relativity.jdbc.RelativityResultSet.finalize(Unknown Source)
      at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
      at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
      at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)

There seems to be no pattern to when this exception will occur and it seems to occur completely independently of any task that is being performed. I have tried to catch the exception anywhere in the application where I am using a ResultSet but have not yet been able to catch it.

Has anyone had similar problems before?

Hi Tom,

Do you have any ideas on what could be causing this?

Thanks,

Blair


I am using JDBC to communicate with Relativity and it seems to work well most of the time but intermittently, seemingly at random, I get the following exception:

java.lang.NullPointerException
      at relativity.jdbc.RPCInterface.SQLFreeStmtSP(Unknown Source)
      at relativity.jdbc.RelativityResultSet.close(Unknown Source)
      at relativity.jdbc.RelativityResultSet.finalize(Unknown Source)
      at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
      at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
      at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)

There seems to be no pattern to when this exception will occur and it seems to occur completely independently of any task that is being performed. I have tried to catch the exception anywhere in the application where I am using a ResultSet but have not yet been able to catch it.

Has anyone had similar problems before?

Hi Blair,

No I don't.  I think it would take having the source available, which I do not have.  

I will try to get the attention of support on this.

Best regards,

Tom Morrison
Hill Country Software


I am using JDBC to communicate with Relativity and it seems to work well most of the time but intermittently, seemingly at random, I get the following exception:

java.lang.NullPointerException
      at relativity.jdbc.RPCInterface.SQLFreeStmtSP(Unknown Source)
      at relativity.jdbc.RelativityResultSet.close(Unknown Source)
      at relativity.jdbc.RelativityResultSet.finalize(Unknown Source)
      at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
      at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
      at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)

There seems to be no pattern to when this exception will occur and it seems to occur completely independently of any task that is being performed. I have tried to catch the exception anywhere in the application where I am using a ResultSet but have not yet been able to catch it.

Has anyone had similar problems before?

Thanks for the stack backtrace. I was going to ask for a test case, but if it is intermittent, creating a test case is going to be hard.

Looking at the source code, I see that SQLFreeStmtSP doesn't check that the protected object m_protoStack is defined.  From the back trace, it appears that this error is occurring during a garbage collection run.  It is possible in some circumstances the socket handle is closed before the statement handle, and when the statement handle is garbage collected, it touches this undefined object.

Is it possible that you don't close all of the statement handles before you disconnect from the server?  (Just a shot in the dark.)


I am using JDBC to communicate with Relativity and it seems to work well most of the time but intermittently, seemingly at random, I get the following exception:

java.lang.NullPointerException
      at relativity.jdbc.RPCInterface.SQLFreeStmtSP(Unknown Source)
      at relativity.jdbc.RelativityResultSet.close(Unknown Source)
      at relativity.jdbc.RelativityResultSet.finalize(Unknown Source)
      at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
      at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
      at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)

There seems to be no pattern to when this exception will occur and it seems to occur completely independently of any task that is being performed. I have tried to catch the exception anywhere in the application where I am using a ResultSet but have not yet been able to catch it.

Has anyone had similar problems before?

Thanks Michael. I have figured out that my code wasn't calling the freeResult method which cleaned up the ResultSet. In addition to this, the PreparedStatement wasn't being explicitly closed because the ResultSet relied on it. I have now modified the freeResult method to close both and fixed the code which was failing to call the freeResult method. As far as I can tell, it all seems to be working.


I am using JDBC to communicate with Relativity and it seems to work well most of the time but intermittently, seemingly at random, I get the following exception:

java.lang.NullPointerException
      at relativity.jdbc.RPCInterface.SQLFreeStmtSP(Unknown Source)
      at relativity.jdbc.RelativityResultSet.close(Unknown Source)
      at relativity.jdbc.RelativityResultSet.finalize(Unknown Source)
      at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
      at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
      at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:190)

There seems to be no pattern to when this exception will occur and it seems to occur completely independently of any task that is being performed. I have tried to catch the exception anywhere in the application where I am using a ResultSet but have not yet been able to catch it.

Has anyone had similar problems before?

Thanks Michael. I have figured out that my code wasn't calling the freeResult method which cleaned up the ResultSet. In addition to this, the PreparedStatement wasn't being explicitly closed because the ResultSet relied on it. I have now modified the freeResult method to close both and fixed the code which was failing to call the freeResult method. As far as I can tell, it all seems to be working.