-->
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.  [ 8 posts ] 
Author Message
 Post subject: how to debug postgres issue after hib3 update?
PostPosted: Thu Oct 06, 2005 10:42 pm 
Beginner
Beginner

Joined: Sun May 02, 2004 8:04 am
Posts: 36
Hi,

I'm at my wit's end here-- I updated my application to hibernate 3 and tested it with hsql and postgres. With hsql it works fine, no problems. However with Postgres some errors have started to show up:

Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main] -- caught unexpected Exception while executing posted task.
java.lang.NullPointerException
at org.postgresql.jdbc2.AbstractJdbc2Statement.close(AbstractJdbc2Statement.java:656)
at com.mchange.v1.db.sql.StatementUtils.attemptClose(StatementUtils.java:38)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache$1.run(GooGooStatementCache.java:246)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:354)


or another error:

Could not complete transaction
org.hibernate.exception.GenericJDBCException: could not initialize a collection: [org.gridlab.gridsphere.portlet.impl.SportletData.Attributes#2c9f7d9706c8d8df0106c8da49b90027]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
....
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.SQLException: You can't operate on a closed connection!!!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:68)
... 70 more
Caused by: java.lang.NullPointerException
at org.postgresql.jdbc2.AbstractJdbc2Statement.close(AbstractJdbc2Statement.java:656)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.close(NewProxyPreparedStatement.java:1674)


Literally all I did was upgrade all hibernate 2 and co. jar files to hibernate 3. I find it strange that with hsql it all works but postgres now has problems accessing the database. Are there any possible flags that can be turned on either to solve the problem or to gain a better understanding why my app is now broken?

I just wish there was a hibernate.postgres.used=true flag or something...

Thanks, Jason


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 2:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
what should hibernate.postgres.used=true do ? Automagically remove possible bugs in postgresssql driver which for some reason has surfaced because you did a MAJOR version upgrade of hibernate ? sorry, but that is not possible at the moment (maybe in Hibernate 2010) - try updating the driver and if that does not work report it to the postgres guys.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 2:40 am 
Beginner
Beginner

Joined: Sun May 02, 2004 8:04 am
Posts: 36
I tried the latest postgres driver with no success-- however, based on the exceptions I reported, I have no way of knowing if this is in fact a postgres problem, a hibernate issue, or something with my own code. I'm happy to start digging but I don't know where...

Thanks, Jason


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 2:41 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
It looks like pool closes statement after connection was closed. Try to drop this pool.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 1:41 pm 
Beginner
Beginner

Joined: Sun May 02, 2004 8:04 am
Posts: 36
Hi,

I had these entries in my props file:

###########################
### C3P0 Connection Pool###
###########################

hibernate.c3p0.max_size 10
hibernate.c3p0.min_size 2
hibernate.c3p0.timeout 5000
hibernate.c3p0.max_statements 100
hibernate.c3p0.idle_test_period 3000
hibernate.c3p0.acquire_increment 2
hibernate.jdbc.batch_size 0


You think I should comment out these lines?

Thanks, Jason


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 2:27 pm 
Beginner
Beginner

Joined: Mon Sep 27, 2004 4:28 pm
Posts: 44
I'm using postgres and Hibernate 3. I just went through the transition and didn't have problems like this. Can you post some more information and I'll try to help?

If you could get it nailed down to a mapping file and a query that are causing you the problem I'll try to reproduce it over here.

Phill


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 5:08 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
As I understand from stack trace "com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.close" is called after connection was closed. There is a bug in application,hibernate or in pool, I do not see it stack trace . Just try to debug it without pool or try to change pool implementation, it will help to find this bug.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 5:31 am 
Newbie

Joined: Mon Oct 25, 2004 9:18 am
Posts: 7
You might want to upgrade your copy of the c3p0 pool library. It could be a pool issue and there where some bugs in c3p0 related to statement closing at the wrong time.


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