Tuesday, November 06, 2007

JPA Connections In Invalid State

Using Glassfish or the Sun Java System Application Server (SJSAS), you will occassionally get the following error:

javax.resource.spi.LocalTransactionException: Connection.close() has already been called. Invalid operation in this state.

It's more prevalent when using JPA with EJB 3.0 in your applications. The solution is surprisingly simple: stop the application server, restart the database (in my case the MySql service), and restart the application server. Simple!


IlPuccio said...

hello, actually it's not so simple, or better, it's not efficient. I got that error but I need to understand why.
Any clue?

Dylan G. said...

I am also having this problem, and I need to know why. I have done some reading and some people think it has to do with the new mysql and jdbc driver on linux.