-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: problem "Not able to obtain connection" when page
PostPosted: Thu Dec 29, 2005 11:43 pm 
Newbie

Joined: Thu Dec 29, 2005 11:21 pm
Posts: 1
The strange thing is when I first vist the web page, it works. But when I refresh the page, it throwed the exception below
ps:I use eclipse with myeclipse plugin.

Hibernate version:3

the exception:
[code]java.lang.RuntimeException: org.hibernate.HibernateException: Not able to obtain connection
com.cqgdcc.hibernate.CustomerService.getCustomersList(CustomerService.java:86)
org.apache.jsp.display_jsp._jspService(display_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)[code]


My code:
[code]public List getCustomersList(){
Session session = null;
try{
session = HibernateSessionFactory.currentSession();
Query query = session.createQuery(
"select Customers from com.cqgdcc.hibernate.Customers Customers");
return query.list();

}catch(HibernateException he){

System.err.println("Hibernate Excepton "+ he.getMessage());
throw new RuntimeException(he);
}finally{[/code]

Name and version of the database i am using:oracle 9i


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 31, 2005 10:02 am 
Newbie

Joined: Sun Dec 19, 2004 8:10 pm
Posts: 10
Location: Australia
Shine,

Usually this is the result of the connection pool being starved for connections. Mostly when the session from the first connect is not closed. Do you close the session in your code?

It may help if you post the page code here if you are calling close.

Connie


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.