You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Pavel Bortnovskiy <PB...@Jefferies.com> on 2011/02/09 16:42:16 UTC

NullPointerException deep in Derby

Hello:

I just got the following NullPointerException, seemingly inside Derby 
code:

2011-02-09 10:39:13,576 ERROR DataProcessor  - SQL Exception due to 
executing statement after shutdown
java.sql.SQLException: The exception 'java.lang.NullPointerException' was 
thrown while evaluating an expression.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
        at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
        at 
org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source)
        at 
com.jefco.processors.DataProcessor.process(DataProcessor.java:189)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: The exception 
'java.lang.NullPointerException' was thrown while evaluating an 
expression.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown 
Source)
        ... 13 more
Caused by: java.sql.SQLException: Java exception: ': 
java.lang.NullPointerException'.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source)
        ... 10 more
Caused by: java.lang.NullPointerException
        at 
org.apache.derby.exe.ac96c5c136x012ex0b13x5d52xffff9ccc25960.e9(Unknown 
Source)
        at 
org.apache.derby.impl.services.reflect.DirectCall.invoke(Unknown Source)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.doProjection(Unknown 
Source)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown 
Source)
        at 
org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowFromSource(Unknown 
Source)
        at 
org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowCore(Unknown 
Source)
        at 
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(Unknown 
Source)
        ... 5 more




Jefferies archives and monitors outgoing and incoming e-mail. The contents of this email, including any attachments, are confidential to the ordinary user of the email address to which it was addressed. If you are not the addressee of this email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. This email may be produced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a result of transmission. Use by other than intended recipients is prohibited.  In the United Kingdom, Jefferies operates as Jefferies International Limited; registered in England: no. 1978621; registered office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ.  Jefferies International Limited is authorised and regulated by the Financial Services Authority.

Re: NullPointerException deep in Derby

Posted by Lily Wei <li...@yahoo.com>.
Hi Pavel:
I file an issue DERBY- 5041 https://issues.apache.org/jira/browse/DERBY-5041 on 
your behave. If there is any addition information, please feel free to add it.  
Like Dag's point out, complex query like this often result from code generation 
error from some bug during binding time and/or optimization time. A real 
life reproducible case will help a lot to debug case like this. And, shorten the 
time to get the bug fixed from Derby-dev.
 
 
Thanks and hope this help,
Lily
 

________________________________
From: Pavel Bortnovskiy <PB...@Jefferies.com>
To: Kathey Marsden <km...@sbcglobal.net>
Cc: Derby Discussion <de...@db.apache.org>
Sent: Wed, February 9, 2011 11:02:00 AM
Subject: Re: NullPointerException deep in Derby

I've always used Derby only as an in-memory DB... 



From:  Kathey Marsden <km...@sbcglobal.net>  
To:  Derby Discussion <de...@db.apache.org>  
Cc:  Pavel Bortnovskiy <PB...@Jefferies.com>  
Date:  02/09/2011 01:54 PM  
Subject:  Re: NullPointerException deep in Derby 
________________________________
 


On 2/9/2011 10:46 AM, Pavel Bortnovskiy wrote:  
Did so, Kathey, but got the same error...

maybe I can't use URL=jdbc:derby:memory:testdb;create=true

in 10.2 and 10.3?
 
Oh yes, I missed that part. in nemory db came later.  Do you get the same error 
with the query against a regular database?

 




Jefferies archives and monitors outgoing and incoming e-mail. The contents of 
this email, including any attachments, are confidential to the ordinary user of 
the email address to which it was addressed. If you are not the addressee of 
this email you may not copy, forward, disclose or otherwise use it or any part 
of it in any form whatsoever. This email may be produced at the request of 
regulators or in connection with civil litigation. Jefferies accepts no 
liability for any errors or omissions arising as a result of transmission. Use 
by other than intended recipients is prohibited.  In the United Kingdom, 
Jefferies operates as Jefferies International Limited; registered in England: 
no. 1978621; registered office: Vintners Place, 68 Upper Thames Street, London 
EC4V 3BJ.  Jefferies International Limited is authorised and regulated by the 
Financial Services Authority.


      

Re: NullPointerException deep in Derby

Posted by Pavel Bortnovskiy <PB...@Jefferies.com>.
I've always used Derby only as an in-memory DB...



From:
Kathey Marsden <km...@sbcglobal.net>
To:
Derby Discussion <de...@db.apache.org>
Cc:
Pavel Bortnovskiy <PB...@Jefferies.com>
Date:
02/09/2011 01:54 PM
Subject:
Re: NullPointerException deep in Derby



On 2/9/2011 10:46 AM, Pavel Bortnovskiy wrote: 
Did so, Kathey, but got the same error... 

maybe I can't use URL=jdbc:derby:memory:testdb;create=true 

in 10.2 and 10.3? 

Oh yes, I missed that part. in nemory db came later.  Do you get the same 
error with the query against a regular database?







Jefferies archives and monitors outgoing and incoming e-mail. The contents of this email, including any attachments, are confidential to the ordinary user of the email address to which it was addressed. If you are not the addressee of this email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. This email may be produced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a result of transmission. Use by other than intended recipients is prohibited.  In the United Kingdom, Jefferies operates as Jefferies International Limited; registered in England: no. 1978621; registered office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ.  Jefferies International Limited is authorised and regulated by the Financial Services Authority.

Re: NullPointerException deep in Derby

Posted by Kathey Marsden <km...@sbcglobal.net>.
On 2/9/2011 10:46 AM, Pavel Bortnovskiy wrote:
> Did so, Kathey, but got the same error...
>
> maybe I can't use URL=jdbc:derby:memory:testdb;create=true
>
> in 10.2 and 10.3?
>
Oh yes, I missed that part. in nemory db came later.  Do you get the 
same error with the query against a regular database?



Re: NullPointerException deep in Derby

Posted by Pavel Bortnovskiy <PB...@Jefferies.com>.
Did so, Kathey, but got the same error...

maybe I can't use URL=jdbc:derby:memory:testdb;create=true

in 10.2 and 10.3?



From:
Kathey Marsden <km...@sbcglobal.net>
To:
Derby Discussion <de...@db.apache.org>
Cc:
Pavel Bortnovskiy <PB...@Jefferies.com>
Date:
02/09/2011 01:32 PM
Subject:
Re: NullPointerException deep in Derby



On 2/9/2011 10:19 AM, Pavel Bortnovskiy wrote: 
Hello, Kathey: 

thank you for prompt response. 

I was running 10.6. Upgraded to 10.7 and encountered the same NPE. 

Downgraded to 10.3 and 10.2 but got a different error 
        Caused by: java.sql.SQLException: No suitable driver found for 
jdbc:derby:memory:testdb;create=true 

What could be a problem there? 
Older versions do not have driver autoloading.  You will need to add:
Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();  to 
your code in the beginning to get the driver loaded.






Jefferies archives and monitors outgoing and incoming e-mail. The contents of this email, including any attachments, are confidential to the ordinary user of the email address to which it was addressed. If you are not the addressee of this email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. This email may be produced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a result of transmission. Use by other than intended recipients is prohibited.  In the United Kingdom, Jefferies operates as Jefferies International Limited; registered in England: no. 1978621; registered office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ.  Jefferies International Limited is authorised and regulated by the Financial Services Authority.

Re: NullPointerException deep in Derby

Posted by Kathey Marsden <km...@sbcglobal.net>.
On 2/9/2011 10:19 AM, Pavel Bortnovskiy wrote:
> Hello, Kathey:
>
> thank you for prompt response.
>
> I was running 10.6. Upgraded to 10.7 and encountered the same NPE.
>
> Downgraded to 10.3 and 10.2 but got a different error
> Caused by: java.sql.SQLException: No suitable driver found for 
> jdbc:derby:memory:testdb;create=true
>
> What could be a problem there?
Older versions do not have driver autoloading.  You will need to add:
Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();  to 
your code in the beginning to get the driver loaded.


Re: NullPointerException deep in Derby

Posted by Pavel Bortnovskiy <PB...@Jefferies.com>.
Hello, Kathey:

thank you for prompt response.

I was running 10.6. Upgraded to 10.7 and encountered the same NPE.

Downgraded to 10.3 and 10.2 but got a different error 
        Caused by: java.sql.SQLException: No suitable driver found for 
jdbc:derby:memory:testdb;create=true

What could be a problem there?



From:
Kathey Marsden <km...@sbcglobal.net>
To:
Derby Discussion <de...@db.apache.org>
Cc:
Pavel Bortnovskiy <PB...@Jefferies.com>
Date:
02/09/2011 12:45 PM
Subject:
Re: NullPointerException deep in Derby



On 2/9/2011 7:49 AM, Pavel Bortnovskiy wrote: 
Additional information: 

the message "executing statement after shutdown" is misleading. There was 
no shutdown occurring and the connection was open and valid. 

Our query (which I cannot show here for now) was complex, with case 
statements and group by. 
Interestingly, as soon as the query was reworked to remove group by 
clause, the code worked flawlessly. 

P. 

Hi Pavel, 

Since your problem is in generated code it is hard to figure out what went 
wrong without more information.
Firstly, I was wondering what version of Derby you are using?  I would 
suggest  moving to the latest release,  10.7 if you are not already there 
to see if the problem still exists. 


If it does, run your query with:
derby.debug.true=DumpClassFile and it will dump the generated class file 
which you can decompile and perhaps get a clue where the problem lies.  I 
don't think that Derby should ever throw this NPE, so I would say at least 
file a Jira bug  with the information that you can share and the stack 
trace.

As a further diagnostic step, there was a major rework and clean up of 
group by in 10.3,  DERBY-681 which resulted in some regressions. Usually 
when I see a group by issue, I will first try the build before and after 
that change to see if it might be related. If you don't want to build 
Derby, as a first step it would be interesting to see if occurs with 10.3. 
but not 10.2 to see if DERBY-681 is suspect. 

Thanks

Kathey




From: 
Pavel Bortnovskiy <PB...@Jefferies.com> 
To: 
Derby Discussion <de...@db.apache.org> 
Date: 
02/09/2011 10:43 AM 
Subject: 
NullPointerException deep in Derby




Hello: 

I just got the following NullPointerException, seemingly inside Derby 
code: 

2011-02-09 10:39:13,576 ERROR DataProcessor  - SQL Exception due to 
executing statement after shutdown 
java.sql.SQLException: The exception 'java.lang.NullPointerException' was 
thrown while evaluating an expression. 
       at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
Source) 
       at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
Source) 
       at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source) 

       at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(UnknownSource) 

       at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(UnknownSource) 

       at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) 

       at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) 

       at 
org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(UnknownSource) 

       at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown 
Source) 
       at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source) 
       at 
com.jefco.processors.DataProcessor.process(DataProcessor.java:189) 
       at java.lang.Thread.run(Thread.java:619) 
Caused by: java.sql.SQLException: The exception 
'java.lang.NullPointerException' was thrown while evaluating an 
expression. 
       at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
Source) 
       at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(UnknownSource) 

       ... 13 more 
Caused by: java.sql.SQLException: Java exception: ': 
java.lang.NullPointerException'. 
       at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
Source) 
       at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(UnknownSource) 

       at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
Source) 
       at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
Source) 
       at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source) 
       at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(UnknownSource) 

       ... 10 more 
Caused by: java.lang.NullPointerException 
       at 
org.apache.derby.exe.ac96c5c136x012ex0b13x5d52xffff9ccc25960.e9(Unknown 
Source) 
       at org.apache.derby.impl.services.reflect.DirectCall.invoke(Unknown 
Source) 
       at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.doProjection(UnknownSource) 

       at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(UnknownSource) 

       at 
org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowFromSource(UnknownSource) 

       at 
org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowCore(UnknownSource) 

       at 
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(UnknownSource) 

       ... 5 more 



Jefferies archives and monitors outgoing and incoming e-mail. The contents 
of this email, including any attachments, are confidential to the ordinary 
user of the email address to which it was addressed. If you are not the 
addressee of this email you may not copy, forward, disclose or otherwise 
use it or any part of it in any form whatsoever. This email may be 
produced at the request of regulators or in connection with civil 
litigation. Jefferies accepts no liability for any errors or omissions 
arising as a result of transmission. Use by other than intended recipients 
is prohibited. In the United Kingdom, Jefferies operates as Jefferies 
International Limited; registered in England: no. 1978621; registered 
office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ. Jefferies 
International Limited is authorised and regulated by the Financial 
Services Authority. 




Jefferies archives and monitors outgoing and incoming e-mail. The contents 
of this email, including any attachments, are confidential to the ordinary 
user of the email address to which it was addressed. If you are not the 
addressee of this email you may not copy, forward, disclose or otherwise 
use it or any part of it in any form whatsoever. This email may be 
produced at the request of regulators or in connection with civil 
litigation. Jefferies accepts no liability for any errors or omissions 
arising as a result of transmission. Use by other than intended recipients 
is prohibited. In the United Kingdom, Jefferies operates as Jefferies 
International Limited; registered in England: no. 1978621; registered 
office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ. Jefferies 
International Limited is authorised and regulated by the Financial 
Services Authority. 






Jefferies archives and monitors outgoing and incoming e-mail. The contents of this email, including any attachments, are confidential to the ordinary user of the email address to which it was addressed. If you are not the addressee of this email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. This email may be produced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a result of transmission. Use by other than intended recipients is prohibited.  In the United Kingdom, Jefferies operates as Jefferies International Limited; registered in England: no. 1978621; registered office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ.  Jefferies International Limited is authorised and regulated by the Financial Services Authority.

Re: NullPointerException deep in Derby

Posted by Kathey Marsden <km...@sbcglobal.net>.
On 2/9/2011 7:49 AM, Pavel Bortnovskiy wrote:
> Additional information:
>
> the message "executing statement after shutdown" is misleading. There 
> was no shutdown occurring and the connection was open and valid.
>
> Our query (which I cannot show here for now) was complex, with case 
> statements and group by.
> Interestingly, as soon as the query was reworked to remove group by 
> clause, the code worked flawlessly.
>
> P.
>
Hi Pavel,

Since your problem is in generated code it is hard to figure out what 
went wrong without more information.
Firstly, I was wondering what version of Derby you are using?  I would 
suggest  moving to the latest release,  10.7 if you are not already 
there to see if the problem still exists.


If it does, run your query with:
derby.debug.true=DumpClassFile and it will dump the generated class file 
which you can decompile and perhaps get a clue where the problem lies.  
I don't think that Derby should ever throw this NPE, so I would say at 
least file a Jira bug  with the information that you can share and the 
stack trace.

As a further diagnostic step, there was a major rework and clean up of 
group by in 10.3,  DERBY-681 which resulted in some regressions. Usually 
when I see a group by issue, I will first try the build before and after 
that change to see if it might be related. If you don't want to build 
Derby, as a first step it would be interesting to see if occurs with 
10.3. but not 10.2 to see if DERBY-681 is suspect.

Thanks

Kathey



>
> From: 	Pavel Bortnovskiy <PB...@Jefferies.com>
> To: 	Derby Discussion <de...@db.apache.org>
> Date: 	02/09/2011 10:43 AM
> Subject: 	NullPointerException deep in Derby
>
>
> ------------------------------------------------------------------------
>
>
>
> Hello:
>
> I just got the following NullPointerException, seemingly inside Derby 
> code:
>
> 2011-02-09 10:39:13,576 ERROR DataProcessor  - SQL Exception due to 
> executing statement after shutdown
> java.sql.SQLException: The exception 'java.lang.NullPointerException' 
> was thrown while evaluating an expression.
>        at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
> Source)
>        at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
>        at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(UnknownSource)
>        at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(UnknownSource)
>        at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
>        at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
>        at 
> org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(UnknownSource)
>        at 
> org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown Source)
>        at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source)
>        at 
> com.jefco.processors.DataProcessor.process(DataProcessor.java:189)
>        at java.lang.Thread.run(Thread.java:619)
> Caused by: java.sql.SQLException: The exception 
> 'java.lang.NullPointerException' was thrown while evaluating an 
> expression.
>        at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source)
>        at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(UnknownSource)
>        ... 13 more
> Caused by: java.sql.SQLException: Java exception: ': 
> java.lang.NullPointerException'.
>        at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source)
>        at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(UnknownSource)
>        at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
> Source)
>        at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
>        at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(UnknownSource)
>        ... 10 more
> Caused by: java.lang.NullPointerException
>        at 
> org.apache.derby.exe.ac96c5c136x012ex0b13x5d52xffff9ccc25960.e9(Unknown Source)
>        at 
> org.apache.derby.impl.services.reflect.DirectCall.invoke(Unknown Source)
>        at 
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.doProjection(UnknownSource)
>        at 
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(UnknownSource)
>        at 
> org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowFromSource(UnknownSource)
>        at 
> org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowCore(UnknownSource)
>        at 
> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(UnknownSource)
>        ... 5 more
>
>
>
> Jefferies archives and monitors outgoing and incoming e-mail. The 
> contents of this email, including any attachments, are confidential to 
> the ordinary user of the email address to which it was addressed. If 
> you are not the addressee of this email you may not copy, forward, 
> disclose or otherwise use it or any part of it in any form whatsoever. 
> This email may be produced at the request of regulators or in 
> connection with civil litigation. Jefferies accepts no liability for 
> any errors or omissions arising as a result of transmission. Use by 
> other than intended recipients is prohibited. In the United Kingdom, 
> Jefferies operates as Jefferies International Limited; registered in 
> England: no. 1978621; registered office: Vintners Place, 68 Upper 
> Thames Street, London EC4V 3BJ. Jefferies International Limited is 
> authorised and regulated by the Financial Services Authority.
>
>
>
>
> Jefferies archives and monitors outgoing and incoming e-mail. The 
> contents of this email, including any attachments, are confidential to 
> the ordinary user of the email address to which it was addressed. If 
> you are not the addressee of this email you may not copy, forward, 
> disclose or otherwise use it or any part of it in any form whatsoever. 
> This email may be produced at the request of regulators or in 
> connection with civil litigation. Jefferies accepts no liability for 
> any errors or omissions arising as a result of transmission. Use by 
> other than intended recipients is prohibited. In the United Kingdom, 
> Jefferies operates as Jefferies International Limited; registered in 
> England: no. 1978621; registered office: Vintners Place, 68 Upper 
> Thames Street, London EC4V 3BJ. Jefferies International Limited is 
> authorised and regulated by the Financial Services Authority. 


Re: NullPointerException deep in Derby

Posted by Pavel Bortnovskiy <PB...@Jefferies.com>.
Additional information:

the message "executing statement after shutdown" is misleading. There was 
no shutdown occurring and the connection was open and valid.

Our query (which I cannot show here for now) was complex, with case 
statements and group by.
Interestingly, as soon as the query was reworked to remove group by 
clause, the code worked flawlessly.

P.



From:
Pavel Bortnovskiy <PB...@Jefferies.com>
To:
Derby Discussion <de...@db.apache.org>
Date:
02/09/2011 10:43 AM
Subject:
NullPointerException deep in Derby



Hello: 

I just got the following NullPointerException, seemingly inside Derby 
code: 

2011-02-09 10:39:13,576 ERROR DataProcessor  - SQL Exception due to 
executing statement after shutdown 
java.sql.SQLException: The exception 'java.lang.NullPointerException' was 
thrown while evaluating an expression. 
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
Source) 
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
Source) 
        at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown 
Source) 
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source) 
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
Source) 
        at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) 

        at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) 

        at 
org.apache.derby.impl.jdbc.EmbedResultSet.closeOnTransactionError(Unknown 
Source) 
        at org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown 
Source) 
        at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown Source) 
        at 
com.jefco.processors.DataProcessor.process(DataProcessor.java:189) 
        at java.lang.Thread.run(Thread.java:619) 
Caused by: java.sql.SQLException: The exception 
'java.lang.NullPointerException' was thrown while evaluating an 
expression. 
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
Source) 
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown 
Source) 
        ... 13 more 
Caused by: java.sql.SQLException: Java exception: ': 
java.lang.NullPointerException'. 
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
Source) 
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown 
Source) 
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
Source) 
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown 
Source) 
        at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source) 
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source) 
        ... 10 more 
Caused by: java.lang.NullPointerException 
        at 
org.apache.derby.exe.ac96c5c136x012ex0b13x5d52xffff9ccc25960.e9(Unknown 
Source) 
        at 
org.apache.derby.impl.services.reflect.DirectCall.invoke(Unknown Source) 
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.doProjection(Unknown 
Source) 
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown 
Source) 
        at 
org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowFromSource(Unknown 
Source) 
        at 
org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowCore(Unknown 
Source) 
        at 
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(Unknown 
Source) 
        ... 5 more 



Jefferies archives and monitors outgoing and incoming e-mail. The contents 
of this email, including any attachments, are confidential to the ordinary 
user of the email address to which it was addressed. If you are not the 
addressee of this email you may not copy, forward, disclose or otherwise 
use it or any part of it in any form whatsoever. This email may be 
produced at the request of regulators or in connection with civil 
litigation. Jefferies accepts no liability for any errors or omissions 
arising as a result of transmission. Use by other than intended recipients 
is prohibited. In the United Kingdom, Jefferies operates as Jefferies 
International Limited; registered in England: no. 1978621; registered 
office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ. Jefferies 
International Limited is authorised and regulated by the Financial 
Services Authority.





Jefferies archives and monitors outgoing and incoming e-mail. The contents of this email, including any attachments, are confidential to the ordinary user of the email address to which it was addressed. If you are not the addressee of this email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. This email may be produced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a result of transmission. Use by other than intended recipients is prohibited.  In the United Kingdom, Jefferies operates as Jefferies International Limited; registered in England: no. 1978621; registered office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ.  Jefferies International Limited is authorised and regulated by the Financial Services Authority.

Re: NullPointerException deep in Derby

Posted by "Dag H. Wanvik" <da...@oracle.com>.
Pavel Bortnovskiy <PB...@Jefferies.com> writes:

> Caused by: java.lang.NullPointerException at
> org.apache.derby.exe.ac96c5c136x012ex0b13x5d52xffff9ccc25960.e9(Unknown Source) at
> org.apache.derby.impl.services.reflect.DirectCall.invoke(Unknown Source) at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.doProjection(Unknown Source) at
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(Unknown Source) at
> org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowFromSource(Unknown Source) at
> org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet.getNextRowCore(Unknown Source) at
> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(Unknown Source)
>         ... 5 more

In cases like these, when GROUP BY is involved in a possibly complex
query, it is likely that code generation is in error, which again often
results from some bug during binding time and/or optimization time. To
debug this we would need something to reproduce the situation.

If you can't post the original query and correponding DDL, please see if
you can produce a repro by extracting similar DDL and query in a way
that won't give away you business secrets ;-)

Thanks,
Dag