【asm】java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit

環境:Spring2.0 Hibernate3.1.x/Hibernate3.2

在使用Spring的AOP編程時,會用到這幾個lib:
asm-2.2.2.jar
asm-commons-2.2.2.jar
asm-util-2.2.2.jar

Hibernate使用如果lib:
asm.jar
asm-attrs.jar


其中asm-2.2.2.jar與asm.jar存在類上的衝突!!!
使用其中之一或兩者都使用,可能會出現如下錯誤:
java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor
java.lang.NoClassDefFoundError: org/objectweb/asm/commons/EmptyVisitor
java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit。。。。。。


解決辦法是:
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


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