-->
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.  [ 1 post ] 
Author Message
 Post subject: Cannot Open Connection Exception
PostPosted: Wed Feb 27, 2008 5:06 am 
Newbie

Joined: Wed Feb 27, 2008 4:47 am
Posts: 1
I get a Open Connection Exception while trying to invoke beginTransaction().

Details are given below:

Hibernate version: 3.2

Mapping documents:

<hibernate-configuration>

<session-factory>

<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:oci:@xxx</property>
<property name="connection.username">abc</property>
<property name="connection.password">abc</property>

<!-- configuration pool via c3p0-->
<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.idle_test_period">100</property> <!-- seconds -->
<property name="c3p0.max_size">100</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">5</property>
<property name="c3p0.timeout">100</property> <!-- seconds -->

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">2</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.OracleDialect</property>

<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">false</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">validate</property>

<mapping resource="some.hbm.xml"/>

</session-factory>

</hibernate-configuration>

Code between sessionFactory.openSession() and session.close():

Session s = factory.openSession();
Transaction tx=null;
Object result = null;

try {
tx = s.beginTransaction();
List resultList = s.createCriteria(DBCacheStore.class).add(Expression.eq("key", key)).list();
if(resultList != null && resultList.size() > 0) {
DBCacheStore store = (DBCacheStore)resultList.get(0);
return store;
}
tx.commit();

return null;
} catch(Exception e) {
e.printStackTrace();
if (tx != null) tx.rollback();
throw new DBCacheException(e.getMessage());
} finally {
s.close();
}


Full stack trace of any exception that occurs:


org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java(Compiled Code))
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java(Inlined Compiled Code))
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java(Compiled Code))
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java(Compiled Code))
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java(Compiled Code))
at com.xxx.cache.DBCache.getDBCacheStore(DBCache.java(Compiled Code))
at com.xxx.cache.DBCache.get(DBCache.java(Compiled Code))
at com.xxx.cache.ProfileCache.get(ProfileCache.java(Compiled Code))
at com.xxx.aggregator.ExecutionTree.ExecuteSearch(ExecutionTree.java(Compiled Code))
at com.xxx.service.SearchRequestHandler.Execute(SearchRequestHandler.java(Compiled Code))
at com.xxx.service.RequestHandler.Execute(RequestHandler.java(Compiled Code))
at com.xxx.core.RunnableRequest.run(RunnableRequest.java(Compiled Code))
at com.xxx.core.AtAThread.run(AtAThread.java(Compiled Code))
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java(Inlined Compiled Code))
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java(Compiled Code))
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java(Compiled Code))
... 13 more
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.awaitAvailable(BasicResourcePool.java:1319)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java(Compiled Code))
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java(Compiled Code))
... 16 more


Name and version of the database you are using: Oracle 9i

The generated SQL (show_sql=true): false

[/quote]

_________________
Jerry Pereira


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.