-->
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.  [ 5 posts ] 
Author Message
 Post subject: C3P0 cant find driver....
PostPosted: Wed Apr 27, 2005 7:30 pm 
Newbie

Joined: Wed Apr 27, 2005 7:12 pm
Posts: 2
Hello

I am fairly new to hibernate, so excuse me if i am asking stupid..

My problem is that C3P0 dosent seem to get the corect Driver file.
The driver .jar is in the classpath, but still i get the folowing from log4j:

Quote:
01:09:41,473 INFO Environment:460 - Hibernate 3.0
01:09:41,473 INFO Environment:478 - loaded properties from resource hibernate.properties: {hibernate.c3p0.timeout=300, connection.url=jdbc:postgresql://localhost:5432/persAdmin, hibernate.connection.driver_class=org.postgresql.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.c3p0.max_statements=500, hibernate.c3p0.max_size=20, hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect, hibernate.c3p0.idle_test_period=3000, hibernate.c3p0.min_size=5, hibernate.connection.username=nbk, hibernate.connection.password=****}
01:09:41,483 INFO Environment:506 - using CGLIB reflection optimizer
01:09:41,483 INFO Environment:536 - using JDK 1.4 java.sql.Timestamp handling
01:09:41,573 INFO Configuration:460 - Mapping resource: Member.hbm.xml
01:09:41,934 DEBUG DTDEntityResolver:42 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
01:09:41,934 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
01:09:42,124 INFO HbmBinder:258 - Mapping class: Member -> MEMBER
01:09:42,134 DEBUG HbmBinder:1089 - Mapped property: id -> MEMBER_ID
01:09:42,154 DEBUG HbmBinder:1089 - Mapped property: name -> NAME
01:09:42,154 DEBUG HbmBinder:1089 - Mapped property: email -> MEMBER_EMAIL
01:09:42,164 DEBUG HbmBinder:1089 - Mapped property: fee -> MEMBER_FEE
01:09:42,164 DEBUG Configuration:1047 - Preparing to build session factory with filters : {}
01:09:42,164 INFO Configuration:851 - processing extends queue
01:09:42,174 INFO Configuration:855 - processing collection mappings
01:09:42,174 INFO Configuration:864 - processing association property references
01:09:42,174 INFO Configuration:893 - processing foreign key constraints
01:09:42,264 INFO Dialect:91 - Using dialect: org.hibernate.dialect.PostgreSQLDialect
01:09:42,284 DEBUG SQLExceptionConverterFactory:52 - Using dialect defined converter
01:09:42,284 INFO SettingsFactory:90 - Default batch fetch size: 1
01:09:42,284 INFO SettingsFactory:94 - Generate SQL with comments: disabled
01:09:42,284 INFO SettingsFactory:98 - Order SQL updates by primary key: disabled
01:09:42,284 INFO SettingsFactory:273 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
01:09:42,294 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory
01:09:42,294 INFO SettingsFactory:106 - Query language substitutions: {}
01:09:42,294 INFO C3P0ConnectionProvider:50 - C3P0 using driver: org.postgresql.Driver at URL: null
01:09:42,294 INFO C3P0ConnectionProvider:51 - Connection properties: {user=nbk, password=****}
01:09:42,304 INFO C3P0ConnectionProvider:54 - autocommit mode: false
01:09:42,465 INFO C3P0Registry:77 - Initializing c3p0-0.9.0-pre5 [built 16-April-2005 12:14:45 +0300; debug? true; trace: 10]
01:09:42,745 INFO PoolBackedDataSource:257 - Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@523df [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@102a0a5 [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 102a0a5, idleConnectionTestPeriod -> 3000, initialPoolSize -> 5, maxIdleTime -> 300, maxPoolSize -> 20, maxStatements -> 500, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1f8247d [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1f8247d, jdbcUrl -> null, properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ], factoryClassLocation -> null, identityToken -> 523df, numHelperThreads -> 3 ]
01:09:42,765 DEBUG BasicResourcePool:1172 - An exception occurred while acquiring a resource.


the .properties file looks like this:
Code:
hibernate.connection.username=nbk
hibernate.connection.password=secret
connection.url=jdbc:postgresql://localhost:5432/persAdmin
hibernate.connection.driver_class=org.postgresql.Driver
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=300
hibernate.c3p0.max_statements=500
hibernate.c3p0.idle_test_period=3000


Then C3P0 retries around 30 times, and then i get this:
Quote:
01:25:58,919 WARN BasicResourcePool:1180 - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@15b123b -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).
01:25:58,929 DEBUG SqlUtils:97 - Converting Throwable to SQLException...
com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAcquire(BasicResourcePool.java:927)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:207)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:232)
at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:94)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:118)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1505)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1053)
at PersManager.init(PersManager.java:49)
at PersManager.<init>(PersManager.java:25)
at GUI.<init>(GUI.java:24)
at GUI$3.run(GUI.java:204)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
01:25:58,949 WARN SettingsFactory:142 - Could not obtain connection metadata
java.sql.SQLException: Connections could not be acquired from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:104)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:236)
at com.mchange.v2.c3p0.PoolBackedDataSource.getConnection(PoolBackedDataSource.java:94)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:35)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:118)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1505)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1053)
at PersManager.init(PersManager.java:49)
at PersManager.<init>(PersManager.java:25)
at GUI.<init>(GUI.java:24)
at GUI$3.run(GUI.java:204)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAcquire(BasicResourcePool.java:927)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:207)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:232)
... 16 more
01:25:58,999 INFO SettingsFactory:148 - JDBC batch size: 15
01:25:58,999 INFO SettingsFactory:151 - JDBC batch updates for versioned data: disabled
01:25:58,999 INFO SettingsFactory:156 - Scrollable result sets: disabled
01:25:59,009 DEBUG SettingsFactory:160 - Wrap result sets: disabled
01:25:59,009 INFO SettingsFactory:164 - JDBC3 getGeneratedKeys(): disabled
01:25:59,009 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
01:25:59,009 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
01:25:59,039 INFO SettingsFactory:176 - Automatic flush during beforeCompletion(): disabled
01:25:59,039 INFO SettingsFactory:179 - Automatic session close at end of transaction: disabled
01:25:59,039 INFO SettingsFactory:260 - Cache provider: org.hibernate.cache.EhCacheProvider
01:25:59,039 INFO SettingsFactory:187 - Second-level cache: enabled
01:25:59,039 INFO SettingsFactory:192 - Optimize cache for minimal puts: disabled
01:25:59,039 INFO SettingsFactory:199 - Structured second-level cache entries: enabled
01:25:59,039 INFO SettingsFactory:203 - Query cache: disabled
01:25:59,039 INFO SettingsFactory:214 - Statistics: disabled
01:25:59,049 INFO SettingsFactory:218 - Deleted entity synthetic identifier rollback: disabled
01:25:59,049 INFO SettingsFactory:232 - Default entity-mode: pojo
01:25:59,179 DEBUG BasicResourcePool:1172 - An exception occurred while acquiring a resource.
java.lang.NullPointerException
at org.postgresql.Driver.parseURL(Driver.java:408)
at org.postgresql.Driver.acceptsURL(Driver.java:268)
at java.sql.DriverManager.getDriver(DriverManager.java:232)
at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:158)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:81)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:96)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0PooledConnectionPool.java:89)
at com.mchange.v2.resourcepool.BasicResourcePool.assimilateResource(BasicResourcePool.java:941)
at com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool.java:646)
at com.mchange.v2.resourcepool.BasicResourcePool.access$500(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1162)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:366)
01:25:59,219 WARN BasicResourcePool:1180 - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@e555bd -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30).


As far i can see, the problem is that C3P0 dont seems to know what driver to use... even though it is in the classpath, and specified in the .properties file..

Sorry if this is a dumb question - just quite annoyng to have this problem...
plz. help...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 28, 2005 3:53 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Why doesn't this line have a 'hibernate.' infront?

connection.url=jdbc:postgresql://localhost:5432/persAdmin


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 28, 2005 4:03 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Have you even bodered to read the trace:

Quote:
My problem is that C3P0 dosent seem to get the corect Driver file.


01:09:42,294 INFO C3P0ConnectionProvider:50 - C3P0 using driver: org.postgresql.Driver at URL: null

Quote:
java.lang.NullPointerException
at org.postgresql.Driver.parseURL(Driver.java:408)
at org.postgresql.Driver.acceptsURL(Driver.java:268


Or for that matter - even trying to find a source of the problem:
my previous post.

Next time:
http://www.hibernate.org/ForumMailinglists/HowToAskForHelp[/b]


Top
 Profile  
 
 Post subject: Well
PostPosted: Thu Apr 28, 2005 4:49 am 
Newbie

Joined: Wed Apr 27, 2005 7:12 pm
Posts: 2
Achurly yes - i have read the howto, and i have hurled througt the stacktrace, i ain't that dumb.

The question is a mater of fact also about those lines you pointed out (the ones i highlighted in the first post)

I realized the problem, but could not understand why C3P0 could not find the right driver.

Achurly, i am happy now, you correctly pointed at the error, but then again you should be nicer to new members.

The reson that i removed that line, was, that i used
Code:
Config.setProperties(System.getProperties());

wich resulted in the problem that no jdbc connection was to find, no matter what i wrote in the properties file.
Therefore i tried everything before i in the forum found that i should remove that line.
Then i must have forgot to undo every little thing i changed at 2 am last night.

I am sorry for the troubble, and thank you for the help.

best regards
Anders Kobberup


Top
 Profile  
 
 Post subject: Re: Well
PostPosted: Thu Apr 28, 2005 5:05 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
anders@kobberup.dk wrote:
I realized the problem, but could not understand why C3P0 could not find the right driver.


It found the right driver - and it was clearly stated.

New member or not new member - it's the same for all:
Forums are not meant to simply do work for you
- http://www.jroller.com/page/bensond/20050210


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