java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()

前端 未结 4 978
天涯浪人
天涯浪人 2021-01-05 19:54

I have a maven project that uses spring, hibernate (3.6.4), GWT(2.3), drools,.... Everything used to work fine till I began using hibernate OneToMany, ManyToMany relations..

相关标签:
4条回答
  • 2021-01-05 20:30

    We had the exact same problem and outputting OneToMany.class.getProtectionDomain().getCodeSource().getLocation() showed us the problem. We were picking up ejb3 JAR due to a stale dependency in our pom. Thank you very much for posting this solution!

    By the way, remember to run mvn eclipse:eclipse if you're using Eclipse, else the .classpath will still refer to the unwanted JAR.

    0 讨论(0)
  • 2021-01-05 20:33

    i had the same problem, i soved it by removing the persistence-api-1.0.2.jar from the classpath

    0 讨论(0)
  • 2021-01-05 20:42

    Thanks....This helped me with the same problem. When running as a web app I got the "Bad" path but when running as an application I got the "Good" path.

    Bad /C:/Program Files (x86)/IBM/SDP/runtimes/base_v7/plugins/javax.j2ee.persistence.jar

    Good /C:/hibernate-release-4.1.7.Final%20(1)/hibernate-release-4.1.7.Final/lib/required/hibernate-jpa-2.0-api-1.0.1.Final.jar

    0 讨论(0)
  • 2021-01-05 20:46

    It causes with use of persistence-api annotations in entity classes, to resolve this problem let your classpath contains

            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-annotations</artifactId>
                <version>3.4.0.GA</version>
                <scope>provided</scope>
            </dependency>
    

    this dependency to use of ejb3-persistence.jar

    0 讨论(0)
提交回复
热议问题