Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQLException throws after changing C3P0 configuration

 
Darshan Gohel
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Darshan Gohel
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic