Question

We have JBOSS 4.0.3.SP1 over TOMCAT 5.25.26 application server.

Usually it works fine, but about once a month we have "No ManagedConnections available"

Caused by: org.jboss.util.NestedSQLException: No ManagedConnections available within configured blocking timeout ( 5000 [ms] ); - nested throwable: (javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 5000 [ms] ))
        at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:79)
    at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)
    at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
    ... 73 more
Caused by: javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 5000 [ms] )
    at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:246)
    at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:529)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:410)
    at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:342)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:462)
    at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:894)
    at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:73)

When I look in oracle sessions table I can see that there ara all 100 available connections are INACTIVE and the last sql was the one we use to check connection (select sysdate from dual).

Connection pool just cannot reuse them Why this can happen?

We have JNDI datasource defined in oracle-ds.xml like this:

<datasources>
  <local-tx-datasource>
    <jndi-name>ROT</jndi-name>
    <connection-url>jdbc:oracle:thin:@ttt.tt.tt:1521:usr</connection-url>
        <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
        <user-name>usr</user-name>
        <password>usrpass</password>
        <min-pool-size>5</min-pool-size>
        <max-pool-size>100</max-pool-size>
        <idle-timeout-minutes>10</idle-timeout-minutes>
        <track-statements>true</track-statements>
        <blocking-timeout-millis>5000</blocking-timeout-millis>
    <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
        <check-valid-connection-sql>select sysdate from dual</check-valid-connection-sql>

      <metadata>
         <type-mapping>Oracle9i</type-mapping>
      </metadata>
  </local-tx-datasource>

</datasources>

Here is the hibernate config for datasource:

<bean id="rotSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialec</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.format_sql">false</prop>
            <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
            <prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop>
            <prop key="hibernate.jdbc.batch_size">20</prop>
            <prop key="hibernate.connection.release_mode">after_statement</prop>

            <prop key="hibernate.c3p0.min_size">5</prop>
            <prop key="hibernate.c3p0.max_size">20</prop>
            <prop key="hibernate.c3p0.timeout">300</prop>
            <prop key="hibernate.c3p0.max_statements">50</prop>
            <prop key="hibernate.c3p0.idle_test_period">3000</prop>
        </props>
    </property>
    <property name="dataSource" ref="dataSource"/>

Data source in hibernate:

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top