wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Getting an exception in Hibernate, was fine till yesterday Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Getting an exception in Hibernate, was fine till yesterday" Watch "Getting an exception in Hibernate, was fine till yesterday" New topic
Author

Getting an exception in Hibernate, was fine till yesterday

Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
Hi All,

I am using Hibernate 3. Tomcat 6.

This is my HibernateUtil

This is in my hibernate configuration
Arun Rao
Ranch Hand

Joined: Jan 23, 2004
Posts: 41
Looks like you ran out of threads in the pool. Look for unclosed resultset, connections or query statements. Also check for the permission on the database if it is allowing multiple connections from your application user.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Sometimes it can even be a firewall issue. Maybe the firewall settings have changed?
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

java.sql.SQLException: DBCP could not obtain an idle db connection, pool exhausted


Looks like you are not closing connections. Prob in the case of exceptions. Where is your close connections code??


===Vyas Sanzgiri===
My Blog
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
Thanks for the replies.

I checked for unclosed connections. There isn't any, at least from the code.

Where is your close connections code??

I close all in the finally block of the code.


Is there any way I can check for open connections?


Sometimes it can even be a firewall issue. Maybe the firewall settings have changed?

Can you elaborate on this please ?

Also check for the permission on the database if it is allowing multiple connections from your application user.

Where do I check for this?

Thanks
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
So I changed the settings in the server.xml from

to this

It worked for now. But dont know for long it will work.
Is there any other changes I can make so this does not happen again.

Thanks
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

Those are important settings. I think you fixed the problem!
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
Thanks Vyas.

Any idea about the best practices for those settings. In a production system would those settings I have given now work?

Thanks
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

I use the following settings but it depends on your environment and performance aspects. There is no best setting

maxActive="10"
maxIdle="100"
maxWait="3000"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting an exception in Hibernate, was fine till yesterday