Hibernate Error

来源:互联网 发布:手机淘宝怎么登录不上 编辑:程序博客网 时间:2024/06/03 11:18

Problem::JavaReflectionManager cannot be cast to MetadataProviderInjector

Using Hibernate annotation, after upgraded Hibernate version from v3.2.7 tov3.6, it hits following error message :

Caused by: java.lang.ClassCastException: org.hibernate.annotations.common.reflection.java.JavaReflectionManager cannot be cast to org.hibernate.annotations.common.reflection.MetadataProviderInjector

Here’s the list of the Hibernate annotation libraries :

  1. hibernate3-3.6.0.Final.jar
  2. hibernate-annotations-3.4.0.GA.jar
  3. hibernate-commons-annotations-3.0.0.GA.jar

Solution

Hibernate annotation module is merged into Hibernate core module since v3.5 (if not mistake). In this case, Hibernate is detected two annotation modules, from both “Hibernate core” and “Hibernate annotation“, causing conflict and prompt the ClassCastException.

To fix it, just delete both of the hibernate-annotations-3.4.0.GA.jar andhibernate-commons-annotations-3.0.0.GA.jar, because latest Hibernate core library is able to perform annotation task without other dependency.

0 0
原创粉丝点击