org.hibernate.HibernateException: No Session found for current thread
    at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:97)
    at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:990)

一直提示这个错误No Session found for current thread。

其他的各种配置都正确,最后在web.xml中发现了错误,添加如下代码:


    OpenSessionInViewFilter
      
         
            org.springframework.orm.hibernate4.support.OpenSessionInViewFilter
         
         
        
            H4TxManager
            mysqlSessionFactory
            
                
        
         singleSession
        true
        
    

    openSessionInViewFilter
    /*