My problem is that the query works fine for about 10 to 20 concurrent requests than the connection to the database is no longer available. Then the context has to be reloaded to make it work again.
I have tried using c3p0 and the hibernate connection pooling with about the same results. Playing with the max_size and min_size arguments of c3p0 changes the number of concurrent requests but eventually leads to the same error.
I am using the newest oracle jdbc driver (ojdbc14_g.jar)
Hibernate version:
3.0.5
Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.timeout">1800</property>
<property name="hibernate.cglib.use_reflection_optimizer">true</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">********</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@ora1host:1561:ora1</property>
<property name="hibernate.connection.username">seminardb</property>
<property name="hibernate.default_schema">SEMINARDB</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
</session-factory>
</hibernate-configuration>
Code between sessionFactory.openSession() and session.close():Code:
List list = session.createQuery(
"select s.id as id, s.seminartyp.name as name, min(t.datum) as beginn, max(t.datum) as ende\n" +
"from Seminar s join s.seminartage t\n" +
"where year(t.datum) = 2006\n" +
"group by s.id, s.seminartyp.name\n" +
"having (month(min(t.datum)) = 3\n" +
"or month(max(t.datum)) = 3)\n" +
"order by min(t.datum)"
).list();
Full stack trace of any exception that occurs:Code:
INFO: Server startup in 1432 ms
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@65b738
[ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@1d840cd
[ 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, idleConnectionTestPeriod -> 0, initialPoolSize -> 5,
maxIdleTime -> 1800, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 0,
minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1a7f9dc
[ description -> null, driverClass -> null, factoryClassLocation -> null,
jdbcUrl -> jdbc:oracle:thin:@ora1host:1561:ora1, properties -> {user=******, password=******}
] , preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false,
testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false
] , factoryClassLocation -> null, numHelperThreads -> 3, poolOwnerIdentityToken -> 65b738
]
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@a2a38 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@13c2d7f ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@b2fb1e ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@b8d09d ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@bdb375 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@6b51d8 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1352447 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@f77511 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@f5b2e4 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@162f030 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@ce796 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@15738e0 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@12022b7 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@17aa2a8 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1ad6c98 ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1bb205a ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1cb374f ...
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@1f4cf6f ...
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12500, TNS:listener failed to start a dedicated server process
The Connection descriptor used by the client was:
ora1host:1561:ora1
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:158)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:399)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:342)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:375)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:151)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:590)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:68)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:87)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0PooledConnectionPool.java:83)
at com.mchange.v2.resourcepool.BasicResourcePool.assimilateResource(BasicResourcePool.java:884)
at com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool.java:601)
at com.mchange.v2.resourcepool.BasicResourcePool.access$400(BasicResourcePool.java:31)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1079)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:354)
Name and version of the database you are using:
ORACLE 10g