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 <kmarsdenderby@sbcglobal.net>
To: Derby Discussion <derby-user@db.apache.org>
Cc: Pavel Bortnovskiy <PBortnovskiy@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 <PBortnovskiy@Jefferies.com>
To: Derby Discussion <derby-user@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.