- Caused by: java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/Session;
- at org.springframework.orm.hibernate4.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:412)
- ... 34 more
什么原因嗯?
项目使用maven构建:
根本原因:hibernate版本不一致,3和4混着用了。
解决方法:因为我打算用hibernate4,所以去掉hibernate3的依赖
- <dependency>
- <groupId>com.xxx</groupId>
- <artifactId>abc</artifactId>
- <version>0.2.8-SNAPSHOT</version>
- <exclusions>
- <exclusion>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
这样就排除了:
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.6.ga</version>