1

I'm using OC4J 10.1.3.5.0 and there is a problem with jpa 2. I put hibernate-jpa-2.0-api-1.0.1.Final.jar in the class path. When deploy my app and use @OneToMany annotation in my code, I get this exception: java.lang.NoSuchMethodError:javax.persistence.OneToMany.orphanRemoval()Z

When i remove it from code, my app runs normally.

Stijn Haus
  • 481
  • 3
  • 18
ali
  • 31
  • 1
  • 6

2 Answers2

1

You have incompatible JPA library in the classpath. The error "java.lang.NoSuchMethodError" says there is no method "orphanRemoval()" in class "javax.persistence.OneToMany". You should be able to check the library version based on the stack trace.

Check the class in OC4J deployed war file directory. Also make sure there are no conflicting libraries in the OC4J container lib directory (they would take precedence over your packaged jars).

Rajendra
  • 1,703
  • 2
  • 16
  • 22
  • these exception occurs only when i use OneToMany Annotation and when i use ManyToOne no exception occurs – ali Mar 21 '13 at 21:15
  • But it surely has incompatible libraries in the classpath (NoSuchMethodError), try debugging into the hibernate libraries and check if its picking the correct jar. Have you looked @ 1) http://forum.springsource.org/showthread.php?94720-NoSuchMethodError-javax-persistence-OneToMany-orphanRemoval()Z 2) http://stackoverflow.com/questions/3189056/hibernate-3-5-x-nosuchmethoderror-javax-persistence-onetomany-orphanremoval 3) http://stackoverflow.com/questions/4591684/java-lang-nosuchmethoderror-javax-persistence-onetomany-orphanremovalz – Rajendra Mar 22 '13 at 13:41
1

OC4J_PATH\j2ee\home\lib\persistance.jar this jar file jpa 1 and loaded with server start i replaced this jar with Jpa 2 jar with the same name and my app run normally

ali
  • 31
  • 1
  • 6