ITeye博客

Spring集成Hibernate的BeanCreationException解决方法

wayne446 · 2009-05-12 17:58 · j2ee · Markdown

现象:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in ServletContext resource [/WEB-INF/applicationContextService.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError

问题:
在使用Spring的AOP编程时,会用到这几个lib:
asm-2.2.2.jar
asm-commons-2.2.2.jar
asm-util-2.2.2.jar

cglib-nodep-2.1_3.jar
Hibernate使用的lib:
asm.jar
asm-attrs.jar
其中asm-2.2.2.jar与asm.jar存在类上的冲突

解决办法:
1.去掉类路径上的关于Hibernate的3个lib
asm.jar
asm-attrs.jar
cglib-2.1.3.jar
2.加入Spring中的以下4个lib
asm-2.2.2.jar
asm-commons-2.2.2.jar
asm-util-2.2.2.jar
cglib-nodep-2.1_3.jar

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。