Results 1 to 7 of 7

Thread: No Managed Connections

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Posts
    11

    Default No Managed Connections

    Hello all,
    We are currently using JBOSS4.0.5 , spring-framework-2.0-rc4 and hibernate-3.2.1.ga.

    After about 5 hours of running, we have start to get the following exception.
    Can someone please help?
    Thanks,
    subu

    Code:
    2007-01-23 09:57:35,014 WARN  [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: null
    2007-01-23 09:57:35,014 ERROR [org.hibernate.util.JDBCExceptionReporter] No ManagedConnections available within configured blocking timeout ( 5000 [ms] ); - nested throwable: (javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 5000 [ms] ))
    2007-01-23 09:57:35,014 DEBUG [org.hibernate.jdbc.ConnectionManager] transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
    2007-01-23 09:57:35,014 ERROR [STDERR] 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:420)
    	at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
    	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
    	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1538)
    	at org.hibernate.loader.Loader.doQuery(Loader.java:661)
    	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
    	at org.hibernate.loader.Loader.doList(Loader.java:2211)
    	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
    	at org.hibernate.loader.Loader.list(Loader.java:2090)
    	at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:95)
    	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
    	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)

    Code:
      
        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
        <min-pool-size>10</min-pool-size>
        <max-pool-size>50</max-pool-size>
        <blocking-timeout-millis>5000</blocking-timeout-millis>
        <idle-timeout-minutes>15</idle-timeout-minutes>	
        <metadata>
             <!--<type-mapping>Oracle9i</type-mapping>-->
             <type-mapping>Oracle10g</type-mapping>
        </metadata>
      </local-tx-datasource>

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I'm guessing your running out of database connections. Is it possible to see your connection release mode settings.

    on_close - says to use ConnectionReleaseMode.ON_CLOSE. This setting is left for backwards compatibility, but its use is highly discouraged.
    http://www.hibernate.org/hib_docs/v3...ection-release

    I googled the exception, one example...........
    http://www.jboss.com/index.html?modu...wtopic&t=81382

  3. #3
    Join Date
    Jan 2007
    Posts
    11

    Post

    karldmoore,

    Thanks for your suggestion and I tried setting the ConnectionReleaseMode.after_statement since as per hibernate reference on_close is highly discouraged. Now this exception seems to have disappeared.

    One strange thing, we are using HibernateDaoSupport to access hibernate methods i.e. via HibernateTemplate. One thing puzzles me that isnt spring supposed to manage the hibernate sessions when using hibernateTemplate.
    So any ideas as to why this could happen?

    Also when using create criteria API, I do the following. So is this the right way to do?


    Code:
    	
    
      	       org.hibernate.Session session = super.getSession();	
               Criteria searchCriteria =  session.createCriteria(MyClass.class)		
                .....
    		super.releaseSession(session);

    Thanks
    Subu

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Why do you need to se the connection release mode at all? Won't the default auto be enough? As for the actual problem. Spring does integrate with Hibernate but there are still going to be some underlying Hibernate settings that affect things, like this. As for the code. Why aren't you using the methods on HibernateTemplate instead? It's very rare that I have to use the Session directly. Even then you can still use HibernateTemplate.execute(HibernateCallback).

    http://www.springframework.org/docs/...rnate-template
    http://www.springframework.org/docs/...eTemplate.html

  5. #5
    Join Date
    Jan 2007
    Posts
    11

    Default

    Thanks for your inputs, the reason for my use of the session is to use Criteria API of Hibernate. But as per your suggestion I will try to use HibernateTemplate.execute(HibernateCallback).

  6. #6
    Join Date
    Jan 2007
    Posts
    11

    Default

    using HibernateTemplate.execute(HibernateCallback) instead of using super.getSession() for criteria api is a better way. the exception is gone. Thanks for all the inputs

    Subu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •