Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 弹簧&x2B;JPA-为什么我收到错误java.lang.NoSuchMethodError:javax.persistence.PersistenceContext.properties()?_Spring_Hibernate_Jpa - Fatal编程技术网

Spring 弹簧&x2B;JPA-为什么我收到错误java.lang.NoSuchMethodError:javax.persistence.PersistenceContext.properties()?

Spring 弹簧&x2B;JPA-为什么我收到错误java.lang.NoSuchMethodError:javax.persistence.PersistenceContext.properties()?,spring,hibernate,jpa,Spring,Hibernate,Jpa,我尝试使用Spring+Hibernate JPA,但当我启动jettyt服务器时,我收到以下错误: java.lang.NoSuchMethodError:javax.persistence.PersistenceContext.properties() 你知道吗 非常感谢。您的类路径中可能有JPA1.0库,而不是JPA2.0库。这对我很有用: <dependency> <groupId>org.hibernate.javax.persisten

我尝试使用Spring+Hibernate JPA,但当我启动jettyt服务器时,我收到以下错误: java.lang.NoSuchMethodError:javax.persistence.PersistenceContext.properties()

你知道吗


非常感谢。

您的类路径中可能有JPA1.0库,而不是JPA2.0库。这对我很有用:

    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <version>1.0.0.Final</version>
    </dependency>

org.hibernate.javax.persistence
hibernate-jpa-2.0-api
1.0.0.1决赛

我删除了这种依赖,之后一切正常

    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>annotations-api</artifactId>
        <version>6.0.13</version>
    </dependency>

org.apache.tomcat
注释api
6.0.13