分类: Windows平台
2014-04-14 23:39:37
01.java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
02. at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1837)
03. at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:769)
04. at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
05. at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:636)
06. at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:359)
07. at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:838)
08. at org.hibernate.tool.hbm2ddl.SchemaExport.
09. at org.hibernate.tool.hbm2ddl.SchemaExport.
10. at Test.HibernateORMappingTest.testSchemaExport(HibernateORMappingTest.java:32)
11. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
12. at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
13. at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
14. at java.lang.reflect.Method.invoke(Unknown Source)
15. at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
16. at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
17. at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
18. at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
19. at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
20. at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
21. at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
22. at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
23. at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
24. at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
25. at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
26. at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
27. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
28. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
29. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
30. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
使用MyEclipse创建javaee的Web项目,在使用Hibernate4.3.5的注解功能时出现错误:
java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z 。
解决办法:删除对Java EE 5 Libraries的使用。
问题原因:javaee.jar中的部分类与hibernate-jpa-2.0-api-1.0.0.Final.jar存在版本冲突。