title: SQL connection not available on websphere 6.1 (spring/hibernate/oracle)
body: <p>When our application starts up it can't seem to connect to the database (using JNDI) on websphere 6.1.</p>
  
  <p>There are no errors in the logs until hibernate initializes the connection provider; it hangs for 180 seconds (I'm guessing this is the connection timeout set on the datasource) and then:</p>
  
  <pre><code>[2011-08-19 10:48:27,585] INFO  [SoapConnectorThreadPool : 1] [o.h.c.ConnectionProviderFactory] Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider µ
  [2011-08-19 10:51:27,628] DEBUG [SoapConnectorThreadPool : 1] [o.h.util.JDBCExceptionReporter] SQL Exception com.ibm.websphere.ce.cm.ConnectionWaitTimeoutException: Connection not available, Timed out waiting for 180029
              at com.ibm.ws.rsadapter.AdapterUtil.toSQLException(AdapterUtil.java:1362) ~[com.ibm.ws.runtime_6.1.0.jar:na]
              at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:462) ~[com.ibm.ws.runtime_6.1.0.jar:na]
              at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:418) ~[com.ibm.ws.runtime_6.1.0.jar:na]
              at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81) ~[spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:113) [hibernate-core-3.6.5.Final.jar:3.6.5.Final]
              at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863) [hibernate-core-3.6.5.Final.jar:3.6.5.Final]
              at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859) [hibernate-core-3.6.5.Final.jar:3.6.5.Final]
              at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870) [hibernate-core-3.6.5.Final.jar:3.6.5.Final]
              at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860) [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779) [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) [spring-orm-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE]
              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) [spring-beans-3.0.5.RELEASE.jar:3.0.5.RELEASE] :
  </code></pre>
  
  <p>The database itself is fine (we can connect to it using a db tool) and the same application does work at times without changing any code or configuration. Also, on our local WAS the application runs without issues but here we do use a different oracle.</p>
  
  <p>Any hint or thoughts on the issue are more than welcome.</p>
  
  <p><strong>UPDATE:</strong><br>
  After further investigation it seems that the above error is because there are no more connections available in the pool. I don't know if there is a problem with our code (I would expect Hibernate handles this) or configuration or is there a problem in the websphere setup...</p>