Hibernate开发错误

来源:互联网 发布:真丝枕巾 知乎 推荐 编辑:程序博客网 时间:2024/05/19 02:17

Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/Type

解决方法:将Hibernate lib包下的asm.jar添加到项目的library中。

 

 

nested exception is  java.lang.NoClassDefFoundError:net/sf/cglib/proxy/CallbackFilter

解决方法:将Hibernate lib包下的cglib-2.1.3.jar添加到项目的library中。

 

 

org.hibernate.HibernateException: No CurrentSessionContext configured! 

在集成Hibernate的环境下(例如Jboss),要在hibernate.cfg.xml中session-factory段加入:

<property name="current_session_context_class">jta</property>

 

 

 

在不集成Hibernate的环境下(例如使用JDBC的独立应用程序),在hibernate.cfg.xml中session-factory段加入:

<property name="current_session_context_class">thread</property>

 

 

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

因为日志包slf4j包未导入或者不完整  导入log4j-over-slf4j-1.4.3.jar slf4j-api-1.4.3.jar slf4j-jdk14-1.4.3.jar slf4j-log4j12-1.4.3.jar之后正常


org/apache/commons/collections/map/LRUMap
题是hibernate的支持包commons-collections.jar的版本过低,置换为3.1以上版本即可。