-->
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.  [ 4 posts ] 
Author Message
 Post subject: Not able to obtain connection in the 2nd try?
PostPosted: Tue Sep 13, 2005 10:30 pm 
Newbie

Joined: Tue Sep 13, 2005 10:14 pm
Posts: 7
Hibernate version: 3
Name and version of the database you are using: MySQL 5.0

At 1st, Hibernate can retrieve records when "getUserProfileList" is run.
After addition of record and then "getUserProfileList" is called again.
The following error messages display.

Why is it so?? Is the configuration not okay?


org.apache.jasper.JasperException: org.hibernate.HibernateException:
Not able to obtain connection
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.RuntimeException: org.hibernate.HibernateException: Not able
to obtain connection
com.erp.hibernate.UserProfileService.getUserProfileList(UserProfileService.java:182)
org.apache.jsp.user.addUserProfile_jsp._jspService(org.apache.jsp.user.addUserProfile_jsp:120)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 12:30 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
This one is almost as regular as lazy load problem .

Your application probably cannot get a connection because the connection pool has been starved. The connection pool is probably starved because Session.close() is not being called .


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 8:34 am 
Newbie

Joined: Tue Sep 13, 2005 10:14 pm
Posts: 7
I have closed it in the coding.
Moreover, I am the single user on my dev PC.
Should not be run of sessions.

The coding actually I copy from MyEclipseIde.
Currently I am using Hibernate 3.
What error can you guess ?

Thank you.


In UserProfileService.java,

I code like the following,
Session session=null;
try {
session = SessionFactory.currentSession();
session.save(data);
session.flush();
} catch { ... }
finally {
if (session != null)
try {
session.close();


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 12:13 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Are you in a managed environment? If not, change getCurrentSession() to openSession() ... assuming you are not calling a method called currentSession() .


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.