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