0

I try to use Spring + Hibernate JPA but when I start my jettyt server, I receive this error : java.lang.NoSuchMethodError: javax.persistence.PersistenceContext.properties()

Do you have any idea ?

Thanks a lot.

Jonathan Lebrun
  • 1,462
  • 3
  • 20
  • 42

3 Answers3

0

You probably have JPA 1.0 libraries instead of JPA 2.0 libraries somewhere in your classpath. This works for me:

    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <version>1.0.0.Final</version>
    </dependency>
Biju Kunjummen
  • 49,138
  • 14
  • 112
  • 125
0

I deleted that dependence and all works fine after that

    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>annotations-api</artifactId>
        <version>6.0.13</version>
    </dependency>
panser
  • 1,949
  • 22
  • 16
0

Error : java.lang.NoSuchMethodError: javax.persistence.PersistenceContext.properties()[Ljavax/persistence/PersistenceProperty

Resolution:

Run maven dependency tree and exclude below dependency.

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

Example :

<dependency>
        <groupId>com.sc.dc</groupId>
        <artifactId>monitoring</artifactId>
        <version>2.8</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>annotations-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

enter image description here

Sandeep M
  • 248
  • 3
  • 6