Meaningless Drivel is fun!*
The moose likes Object Relational Mapping and the fly likes SQLException throws after changing C3P0 configuration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "SQLException throws after changing C3P0 configuration" Watch "SQLException throws after changing C3P0 configuration" New topic
Author

SQLException throws after changing C3P0 configuration

Darshan Gohel
Greenhorn

Joined: Nov 18, 2009
Posts: 4
Hi All,

We are developing a work flow based system using Struts and Hibernate 3. All is working good until we changed some configuration to implement the Threading and C3P0 for concurrent users. The configuration for this in hibernate.cfg.xml is as below:



There are two types of errors throwing after implementing the same,
1) Closed ResultSet : Error Console for the error is as below:



The code snap for the same is :



Error Comes at this line:

while(rs.next())// Error comes here.


2) Invalid Cursor :Error Console for the error is as below:


The code snap for the same is :



Error Comes at this line:

Address endBAddress=(Address)abstractDao.initliaze(Address.class,rs.getString("endBAddressId"));//Error Comes here.


As from basic debugging we identify that the problem arises when the abstractDao.initliaze() is used. This class basically fetch the data of a table and prepare an object for the same. The code snap for the same is as below:



We are at a very critical stage in the project and this Errors are started.
Kindly suggest us a way by which we can be out with this problems.

Note: All this errors removed if we commented the hibernate.cfg.xml configuration for Thread and C3P0.

Thanks & Regards,
Darsh.


Thanks & Regards,
Darsh.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I'm a bit confused. You say you are using Hibernate, but (other than your Hibernate configuration file) I don't see and Hibernate code or any Hibernate calls in your stacktraces. Why are you using Hibernate config at all?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Darshan Gohel
Greenhorn

Joined: Nov 18, 2009
Posts: 4
Hi Paul,

As i mentioned in my first line,
We are developing a work flow based system using Struts and Hibernate 3.


We have Used JBPM(Java Business Process Machine) to manage the Workflow of the System.

So all the JBPMContext code is related to Hibernate Session. JBPMContext has wrapped the Hibernate Session, and it is maintaining both Hibernate Session and Workflow.

So all the places it is used.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I'll take your word for it - though I still can't see any calls to Hibernate code in your stacktraces. For example, your call seems to be going from something called com.elitecore.workorder.subscriberapplication.dao.SubscriberApplicationDao straight to C3P0 (so it appears this is just using JDBC, not Hibernate). What does SubscriberApplicationDao do? Can you show us some code?
Darshan Gohel
Greenhorn

Joined: Nov 18, 2009
Posts: 4
Hi Paul,

You are right about the direct JDBC Call. Here i am putting the actual code.



But as we see that, inside this the,
Address address1=(Address)abstractDao.initliaze(Address.class,rs.getString("headquarteraddressid"));

which is one from Hibernate.

So is this due to the merge of Hibernate and Pure JDBC. And if so, if i remove the C3P0 configuration from my Hibernate Cnf file than all this functionality is working fine.

I am a beginner in Hibernate, so somewhat confuse with this.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Hmm - I've never seen anyone try to call Hibernate code while processing a JDBC ResultSet! If JBPM piggy-backs on Hibernate I would expect Hibernate to be used throught the application, mixing the two technologies constrains Hibernate to work on only one database type which kind of defeats the purpose of using Hibernate in the first place.

If you comment out the call to your initialize method, does the prblem dissappear? It does sound a little like Hibernate may be closing connections while your JDBC code is still using them.
Darshan Gohel
Greenhorn

Joined: Nov 18, 2009
Posts: 4
Hi Paul,

Actually I am trying to figure it out whether the problem is with Hibernate Side or JBPM, because as far as my basic knowledge of JBPM it uses Hibernate implicitly.

Thanks for quick response and highlighting the JDBC and Hibernate Connection simultaneously.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQLException throws after changing C3P0 configuration
 
Similar Threads
Bacis doubt input property in struts-config.xml
connection problem in mysql
JBosss 5.1.0 and Connection Issue
MYSQL Connection Error
Apache POI, FormFile, and XSSF