Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting an exception in Hibernate, was fine till yesterday

 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using Hibernate 3. Tomcat 6.

This is my HibernateUtil

This is in my hibernate configuration
 
Arun Rao
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometimes it can even be a firewall issue. Maybe the firewall settings have changed?
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??
 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Those are important settings. I think you fixed the problem!
 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic