SpringPersistenceUnitInfo :: AbstractMethodError [英] SpringPersistenceUnitInfo :: AbstractMethodError

查看:81
本文介绍了SpringPersistenceUnitInfo :: AbstractMethodError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Spring 3.0.5,JPA2和Hibernate 3.6.7的应用程序. Maven正在处理我的依赖项管理.这是pom的摘录:

I have an application using Spring 3.0.5, JPA2 and Hibernate 3.6.7. Maven's handling my dependency management. Here's a pom excerpt:

<properties>
  <spring.version>3.0.5.RELEASE</spring.version>
</properties>
<dependencies>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>${spring.version}</version>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>${spring.version}</version>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>${spring.version}</version>
  </dependency>
...
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-hibernate3</artifactId>
    <version>2.0.8</version>
    <scope>compile</scope>
      <exclusions>
         <exclusion>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate</artifactId>
     </exclusion>
      </exclusions>
  </dependency>
  <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>3.6.7.Final</version>
  </dependency>
  <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>3.6.7.Final</version>
    <scope>compile</scope>
  </dependency>
  <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jpa</artifactId>
    <version>2.0.8</version>
    <scope>compile</scope>
  </dependency>
  <dependency>
    <groupId>org.hibernate.java-persistence</groupId>
    <artifactId>jpa-api</artifactId>
    <version>2.0-cr-1</version>
    <scope>compile</scope>
  </dependency>
...

应用程序构建良好,但是,当尝试加载它时,Tomcat容器抱怨以下内容:

The application builds just fine, however, when trying to load it, the Tomcat container complains about the following:


Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

对造成这种情况的任何想法?所有依赖项似乎都完好无损.

Any thoughts on what could be causing this? All the dependencies appear to be intact.

谢谢.

推荐答案

您正在混合Spring 2.x和3.x中的工件.

You are mixing artifacts from Spring 2.x and 3.x.

替换spring-hibernate3spring-jpa的旧版本

<dependency>
     <groupId>org.springframework</groupId>
     <artifactId>spring-orm</artifactId>
     <version>${spring.version}</version>
     <scope>compile</scope>
</dependency> 

这篇关于SpringPersistenceUnitInfo :: AbstractMethodError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆