Hibernate GWT集成抛出“java.lang.NoSuchMethodError:javax.persistence.OneToMany.orphanRemoval()Z”

时间:2010-08-17 01:33:43

标签: java hibernate gwt

这个错误是一场噩梦,我无法弄清楚为什么Hibernate库在部署到Web服务器期间没有加载到类路径中(与GWT捆绑在一起的eclipse集成Jetty服务器)。我看到hibernate-jpa-在部署时将2.0-api-1.0.0.Final.jar添加到Web应用程序类路径中。但是,由于某种原因它仍然没有得到解决。相同的代码,作为普通的Java应用程序(服务器端实体即工作正常) );如果从GWT使用它会抛出。

我是否需要升级(带有最新更新的eclipse 3.5,我似乎没有从谷歌获得任何新版本)?此版本的Web服务器(Jetty)是否不支持JPA2? 任何人都可以指导我。

提前致谢。

Caused by: java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1837)
at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:769)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:636)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:359)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1377)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
at com.examples.helloajax.server.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:29)
... 28 more

1 个答案:

答案 0 :(得分:0)

如果hibernate引导servlet contextInitialized事件,我没有看到这个错误!!我似乎不明白这背后的原因。但是它有效。