我使用的是5.2.8的hibernate的jar包,运行的时候却报错Could not open Hibernate Session for transaction; nested exception is java.lang.NoClassDefFoundError: org/hibernate/engine/transaction/spi/TransactionContext

 

原因配置文件中

<bean >
           <property name="sessionFactory" ref="sessionFactory"></property>
       </bean>

用的是hibernate4

解决方法:1:将换成hibernate-core-5.2.8.Final.jar换成hibernate-core-4.2.4.Final.jar

自己运行能够成功解决问题

              2:class="org.springframework.orm.hibernate5.HibernateTransactionManager"

没有解决bug,但理论上应该是可以的

 

相关文章:

  • 2021-10-11
  • 2022-12-23
  • 2021-08-09
  • 2021-08-24
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-18
  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
相关资源
相似解决方案