Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-07-2007, 06:29 AM
Member
 
Join Date: May 2007
Posts: 38
Marty is on a distinguished road
threads and hibernate
I run a thread that makes connections with hibernate, they are querys of hibernate and if the table has been updated I insert records
It works ok but when I execute the thread, after 2 minutes lost the database connection...
do you know what is the problem?
how can I fix?

org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledN onSpecificException
(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert( SQLStateConverter.j
ava:79)
at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelp
er.java:43)
at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelp
er.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnectio n(ConnectionManager
.java:307)
at org.hibernate.jdbc.ConnectionManager.getConnection (ConnectionManager.
java:109)
at org.hibernate.jdbc.AbstractBatcher.prepareQuerySta tement(AbstractBatc
her.java:105)
at org.hibernate.loader.Loader.prepareQueryStatement( Loader.java:1561)
at org.hibernate.loader.Loader.doQuery(Loader.java:66 1)
at org.hibernate.loader.Loader.doQueryAndInitializeNo nLazyCollections(Lo
ader.java:223)
at org.hibernate.loader.Loader.doList(Loader.java:214 7)
at org.hibernate.loader.Loader.listIgnoreQueryCache(L oader.java:2026)
at org.hibernate.loader.Loader.list(Loader.java:2021)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoa der.java:369)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(Que ryTranslatorImpl.ja
va:298)
at org.hibernate.engine.query.HQLQueryPlan.performLis t(HQLQueryPlan.java
:137)
at org.hibernate.impl.SessionImpl.list(SessionImpl.ja va:1014)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:7 9)
at com.desige.webDocuments.persistent.utils.Hibernate Util.createQuery(Hi
bernateUtil.java:176)
at com.focus.wonderware.actions.HandlerProcesosWonder Ware.HiloChecSacopI
ntouchWonderwareHijo(HandlerProcesosWonderWare.jav a:383)
at com.focus.wonderware.actions.HandlerProcesosWonder Ware.getTagnameWond
erwareQueStanPreconfiguradosInSacopIntouch(Handler ProcesosWonderWare.java:603)
at com.focus.wonderware.intocuh_sacop.actions.HiloChe cheaSacop_Intouch.r
unTask(HiloChecheaSacop_Intouch.java:103)
at com.focus.wonderware.intocuh_sacop.actions.HiloChe cheaSacop_Intouch.r
un(HiloChecheaSacop_Intouch.java:64)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection,
pool exhausted
at org.apache.commons.dbcp.PoolingDataSource.getConne ction(PoolingDataSo
urce.java:103)
at org.apache.commons.dbcp.BasicDataSource.getConnect ion(BasicDataSource
.java:540)
at org.hibernate.connection.DatasourceConnectionProvi der.getConnection(D
atasourceConnectionProvider.java:69)
at org.hibernate.jdbc.ConnectionManager.openConnectio n(ConnectionManager
.java:304)
... 18 more
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool.impl.GenericObjectPool.bor rowObject(GenericOb
jectPool.java:756)
at org.apache.commons.dbcp.PoolingDataSource.getConne ction(PoolingDataSo
urce.java:95)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-07-2007, 08:12 AM
Senior Member
 
Join Date: Mar 2007
Posts: 136
goldhouse is on a distinguished road
How are you obtaining the connection ?
JNDI bind or static variable ?
Can you show me your HibernateUtil class and the way you call this ?
The error shows you tried to execute the createQuery method without having connection .
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-09-2007, 03:32 PM
Member
 
Join Date: May 2007
Posts: 39
Nick15 is on a distinguished road
You are not liberating connections, your connection pool empties and exploits the world =)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using threads Java Tip Java Tips 0 12-11-2007 12:25 PM
Threads one198 Threads and Synchronization 1 11-20-2007 08:15 PM
Using threads as a countdowntimer lacoste Threads and Synchronization 4 07-20-2007 03:06 PM
org.hibernate.ejb.Version <clinit> INFO: Hibernate EntityManager 3.2.0.CR1 Heather Database 2 06-30-2007 05:01 PM
Server n threads ferosh Networking 2 04-29-2007 12:42 AM


All times are GMT +3. The time now is 03:44 PM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org