users@glassfish.java.net

GF + EJB + HIbernate JPA + MySQL works, but only for a while -- why?

From: <glassfish_at_javadesktop.org>
Date: Tue, 13 Nov 2007 04:14:36 PST

I've been struggling with this for months (on and off). I have a couple of web services (stateless session beans) with EJBs for the business logic. I am using the Hibernate implementation of the JPA (C3PO etc). I have successfully deployed the web services under glassfish and connected MySQL. It all works but only for a small number of transactions.

I am using the latest version of everything (AFAIK).

I have no stack trace to show you. I can load the database remotely via the web service and query it successfully. However, after about a dozen transactions MySQL gets an enormous number of "sleeping connections" and then stops accepting more. Of course, I can fiddle with some MySQL variables to give the system a slightly longer up-time but am I right to think the problem is in the connection pooling? I am hoping someone has had a similar problem and can tell me what I've done wrong.

Admission of newbie stupidity: Although I understand that connection pools maintain a cache of connections for re-use purposes, I don't really know why I need gf's connection pool and C3PO. Can I bye-pass one of them?

I have done all sorts of experiments with the source code and I'm fairly sure that the EJBs are manged correctly. Don't forget, it does work for a bit.

Just a few pointers would help. Thx :)
[Message sent by forum member 'rogerp' (rogerp)]

http://forums.java.net/jive/thread.jspa?messageID=245180