Method 1:
These libraries are used in Spring AOP programming:
Asm-2.2.2.jar
Asm-commons-2.2.2.jar
Asm-util-2.2.2.jar
If hibernate uses Lib:
ASM. Jar
Asm-attrs.jar
The asm-2.2.2.jar and ASM. jar have a class conflict !!!
If either of them is used, the following error may occur:
Java. Lang. noclassdeffounderror: ORG/objectweb/ASM/codevisitor
Java. Lang. noclassdeffounderror: ORG/objectweb/ASM/commons/emptyvisitor
Java. Lang. nosuchmethoderror: org. objectweb. ASM. classvisitor. visit ......
Solution:
1. Remove the three lib related to hibernate from the class path.
ASM. Jar
Asm-attrs.jar
Cglib-2.1.3.jar
2. Add the following four libraries in spring
Asm-2.2.2.jar
Asm-commons-2.2.2.jar
Asm-util-2.2.2.jar
Cglib-nodep-2.1_3.jar
Method 2:
These libraries are used in Spring AOP programming:
Asm-2.2.2.jar
Asm-commons-2.2.2.jar
Asm-util-2.2.2.jar
If hibernate uses Lib:
ASM. jarasm-attrs.jar
There is a class conflict between the asm-2.2.2.jar and ASM. jar.
If one or both of them are used, the following error may occur: Java. lang. noclassdeffounderror: ORG/objectweb/ASM/codevisitorjava. lang. noclassdeffounderror: ORG/objectweb/ASM/commons/emptyvisitorjava. lang. nosuchmethoderror: Org. objectweb. ASM. classvisitor. visit
The following is a solution to manually edit your. classpath file, such as me (only part of the content)
Manually copy the last two lines of Hibernate and MySQL drivers to the front of the springframework Lib.
<Classpathentry kind = "con" Path = "melibrary.com. genuitec. Eclipse. hibernate. myeclipse_hibernate3_javascore"/>
<Classpathentry kind = "lib" Path = "webroot/WEB-INF/lib/mysql-connector-java-5.0.4-bin.jar"/>
<Classpathentry kind = "con" Path = "melibrary.com. genuitec. Eclipse. springframework. myeclipse_spring20_core"/>
<Classpathentry kind = "con" Path = "melibrary.com. genuitec. Eclipse. springframework. myeclipse_spring20_dao"/>
<Classpathentry kind = "con" Path = "melibrary.com. genuitec. Eclipse. springframework. myeclipse_spring20_aop"/>
<Classpathentry kind = "con" Path = "melibrary.com. genuitec. Eclipse. springframework. myeclipse_spring20_web"/>
If you try to start the service again, no error will be reported.
I used the jar package of myeclipse here. If you use a custom jar package, you only need to ensure that the spring jar package is loaded after hibernate, and the spring jar package will overwrite the hibernate jar package during project deployment.