log信息2012-09-25 12:30:49,437 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
2012-09-25 12:30:49,437 DEBUG [org.hibernate.impl.SessionImpl] disconnecting session
2012-09-25 12:30:49,453 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] Closing single Hibernate Session in OpenSessionInViewFilter
2012-09-25 12:30:49,453 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] Closing Hibernate Session
2012-09-25 12:30:55,000 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] Using SessionFactory 'sessionFactory' for OpenSessionInViewFilter
2012-09-25 12:30:55,000 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'sessionFactory'
2012-09-25 12:30:55,000 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] Opening single Hibernate Session in OpenSessionInViewFilter
2012-09-25 12:30:55,000 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] Opening Hibernate Session
2012-09-25 12:30:55,000 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 13485438550每次都是死在 opened session at timestamp这块,为啥?从log看session已经每次都关了,而且connection也全部releasehibernate的配置
<property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property> <property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">true</property>
<property name="connection.release_mode">after_transaction</property>
<property name="maxActive">100</property>
<property name="maxIdle">30</property>
<property name="maxWait">-1</property>web.xml
<filter>
<filter-name>osivFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
    <init-param>
    <param-name>singleSession</param-name>
   <param-value>true</param-value>
   </init-param>
</filter> <filter-mapping>
<filter-name>osivFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

解决方案 »

  1.   

    <property name="connection.release_mode">after_transaction</property>这句去掉,每次事务提交都自动释放了。
      

  2.   


    谢谢回复,去了以后还是一样的问题,log变了。2012-09-25 14:11:51,328 DEBUG [org.hibernate.impl.SessionImpl] disconnecting session
    2012-09-25 14:11:51,328 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
    2012-09-25 14:11:51,328 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!
    2012-09-25 14:11:51,343 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] Closing single Hibernate Session in OpenSessionInViewFilter
    2012-09-25 14:11:51,343 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] Closing Hibernate Session
    2012-09-25 14:11:56,875 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] Using SessionFactory 'sessionFactory' for OpenSessionInViewFilter
    2012-09-25 14:11:56,890 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'sessionFactory'
    2012-09-25 14:11:56,890 DEBUG [org.springframework.orm.hibernate3.support.OpenSessionInViewFilter] Opening single Hibernate Session in OpenSessionInViewFilter
    2012-09-25 14:11:56,890 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] Opening Hibernate Session
    2012-09-25 14:11:56,890 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 13485499168
      

  3.   


    隔了将近5分钟才响应,为啥呢?
    2012-09-25 14:11:56,890 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 13485499168
    2012-09-25 14:16:57,406 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'eventManageInitAction'
    2012-09-25 14:16:57,406 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'eventManageInitAction'
    2012-09-25 14:16:57,421 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'accessPermissionCheckServiceImpl'
    2012-09-25 14:16:57,421 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'tblEventDAO'
    2012-09-25 14:16:57,421 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'tblEventRoleDAO'
    2012-09-25 14:16:57,421 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'tblMenuDAO'
    2012-09-25 14:16:57,421 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
    2012-09-25 14:16:57,437 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0'
    2012-09-25 14:16:57,437 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#1'
    2012-09-25 14:16:57,437 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
    2012-09-25 14:16:57,437 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0'
    2012-09-25 14:16:57,437 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#1'
    2012-09-25 14:16:57,453 DEBUG [org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator] Creating implicit proxy for bean 'accessPermissionCheckServiceImpl' with 0 common interceptors and 1 specific interceptors
    2012-09-25 14:16:57,453 DEBUG [org.springframework.aop.framework.Cglib2AopProxy] Creating CGLIB2 proxy: target source is SingletonTargetSource for target object [com.gage.fw.service.AccessPermissionCheckService@179d6f9]
    2012-09-25 14:16:57,453 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Finished creating instance of bean 'accessPermissionCheckServiceImpl'
    2012-09-25 14:16:57,453 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'transactionManager'
    2012-09-25 14:16:57,453 DEBUG [org.springframework.orm.hibernate3.HibernateTransactionManager] Found thread-bound Session [org.hibernate.impl.SessionImpl@10a146] for Hibernate transaction
    2012-09-25 14:16:57,453 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] Registering Spring transaction synchronization for existing Hibernate Session
    2012-09-25 14:16:57,468 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    2012-09-25 14:16:57,468 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
    2012-09-25 14:16:57,468 DEBUG [org.hibernate.SQL] 
        /* criteria query */ select
            this_.SEQ_ID as SEQ1_9_0_,
            this_.MENU_ID as MENU2_9_0_,
            this_.EVENT_NAME as EVENT3_9_0_,
            this_.FORWARD_URL as FORWARD4_9_0_,
            this_.UPDATE_DATE as UPDATE5_9_0_,
            this_.UPDATE_USER as UPDATE6_9_0_,
            this_.INSERT_DATE as INSERT7_9_0_,
            this_.INSERT_USER as INSERT8_9_0_,
            this_.DEL_FLAG as DEL9_9_0_ 
        from
            gageoa.tbl_event this_ 
        where
            this_.FORWARD_URL=? 
            and this_.DEL_FLAG=?
    2012-09-25 14:16:57,484 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open ResultSet (open ResultSets: 0, globally: 0)
    2012-09-25 14:16:57,500 DEBUG [org.hibernate.loader.Loader] result row: EntityKey[com.icss.oa.db.model.TblEvent#215]
    2012-09-25 14:16:57,500 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close ResultSet (open ResultSets: 1, globally: 1)
    2012-09-25 14:16:57,500 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    2012-09-25 14:16:57,500 DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [com.icss.oa.db.model.TblEvent#215]
    2012-09-25 14:16:57,500 DEBUG [org.hibernate.engine.TwoPhaseLoad] done materializing entity [com.icss.oa.db.model.TblEvent#215]
    2012-09-25 14:16:57,500 DEBUG [org.hibernate.engine.StatefulPersistenceContext] initializing non-lazy collections
    2012-09-25 14:16:57,500 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!
    2012-09-25 14:16:57,515 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    2012-09-25 14:16:57,515 DEBUG [org.hibernate.SQL] 
        /* criteria query */ select
            this_.ROLE_ID as y0_ 
        from
            gageoa.tbl_event_role this_ 
        where
            this_.EVENT_ID=? 
            and this_.DEL_FLAG=?
    2012-09-25 14:16:57,531 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open ResultSet (open ResultSets: 0, globally: 0)
    2012-09-25 14:16:57,531 DEBUG [org.hibernate.loader.Loader] result row: 
    2012-09-25 14:16:57,531 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close ResultSet (open ResultSets: 1, globally: 1)
    2012-09-25 14:16:57,531 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    2012-09-25 14:16:57,531 DEBUG [org.hibernate.engine.StatefulPersistenceContext] initializing non-lazy collections
    2012-09-25 14:16:57,531 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!
    2012-09-25 14:16:57,531 DEBUG [org.springframework.orm.hibernate3.SessionFactoryUtils] Flushing Hibernate Session on transaction synchronization
    2012-09-25 14:16:57,546 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] processing flush-time cascades
    2012-09-25 14:16:57,546 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] dirty checking collections
    2012-09-25 14:16:57,546 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
    2012-09-25 14:16:57,546 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
    2012-09-25 14:16:57,546 DEBUG [org.hibernate.pretty.Printer] listing entities:
    2012-09-25 14:16:57,546 DEBUG [org.hibernate.pretty.Printer] com.icss.oa.db.model.TblEvent{insertUser=刘建龙, insertDate=2012-08-29 12:01:00, menuId=00007, eventName=事件一览, seqId=215, updateDate=2012-08-29 12:01:00, delFlag=false, updateUser=刘建龙, forwardUrl=/SM000/AM000/ER003.action}
    2012-09-25 14:16:57,546 DEBUG [org.hibernate.impl.SessionImpl] disconnecting session
    2012-09-25 14:16:57,546 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
    2012-09-25 14:16:57,562 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!
    2012-09-25 14:16:57,578 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Creating instance of bean 'eventManageInitServiceImpl'
    2012-09-25 14:16:57,578 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'tblMenuDAO'
    2012-09-25 14:16:57,593 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'tblEventDAO'
    2012-09-25 14:16:57,593 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
    2012-09-25 14:16:57,593 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0'
    2012-09-25 14:16:57,593 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#1'
    2012-09-25 14:16:57,593 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
    2012-09-25 14:16:57,593 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0'
    2012-09-25 14:16:57,609 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] Returning cached instance of singleton bean 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#1'