spring 与hibernate整合中遇到java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit 异常解决办法

这是由于Hibernate中的asm.jar和Spring 的asm.2.2.2.jar有类冲突引起的;

或者说是asm.2.2.3.jar

 

解决办法两个:

 

1:将asm.2.2.2.jar删除;【这样每次重启时还得删除asm.2.2.2.jar文件(COPY jar包到自己项目的除外)】显然每次都执行很繁琐;

 

2:手动修改.classpath文件;
原来是这样的
...............
    <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.springframework.MYECLIPSE_SPRING20_CORE"/> <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.springframework.MYECLIPSE_SPRING20_AOP"/> <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.springframework.MYECLIPSE_SPRING20_DAO"/> <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.springframework.MYECLIPSE_SPRING20_WEB"/> <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.hibernate.MYECLIPSE_HIBERNATE3_1_CORE"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/msbase.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mssqlserver.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/msutil.jar"/> .....................
把hibernate连接语句和SQL驱动一道上面
.......................
      <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.hibernate.MYECLIPSE_HIBERNATE3_1_CORE"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/msbase.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mssqlserver.jar"/> <classpathentry kind="lib" path="WebRoot/WEB-INF/lib/msutil.jar"/> <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.springframework.MYECLIPSE_SPRING20_CORE"/> <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.springframework.MYECLIPSE_SPRING20_AOP"/> <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.springframework.MYECLIPSE_SPRING20_DAO"/> <classpathentry kind="con" path="melibrary.com.genuitec.eclipse.springframework.MYECLIPSE_SPRING20_WEB"/>
......................
重新启动Tomcat一切OK!

你可能感兴趣的:(spring 与hibernate整合中遇到java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit 异常解决办法)