Spring集成Hibernate的BeanCreationException解決方法

 
現象:
嚴重: 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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章