Re: NullPointerException when trying to PreparedStament.setString()
Posted by: Mark Matthews
Date: September 15, 2005 08:58AM

Tom Coupland wrote:
> Hi Mark,
>
> Sorry for the lack of info, was just about to
> retifiy matters when you posted. Heres may driver
> and sql version numbers
>
> ConnectorJ 3.1.10
> MySql 4.1.10a-standard
>
> I am trying to setup a system with JBoss so that i
> can have my preparred statments living in the JNDI
> where my other objects can get at and use them.
[snip]

Tom,

From your earlier stack trace, it appears this is what is happening now:

1) Someone (JBoss' wrapper code?) closes the prepared statement before you get it.

2) .close() clears the parameter bindings by setting the reference to the array of them to null.

3.) getBindings() tries to refer to this null object reference, and of course an NPE is born.

We'll put our standard "checkClosed()" call in getBindings() so you get a better error message in the future, but you're going to have to dig deeper and see why JBoss is handing out a stale prepared statement. Maybe it's related to how they cache them?

-Mark

Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html

Options: ReplyQuote


Subject
Written By
Posted
Re: NullPointerException when trying to PreparedStament.setString()
September 15, 2005 08:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.