java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V

异常完整信息

严重: Servlet.service() for servlet RegServlet threw exception
java.lang.NoSuchMethodError:
org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
at net.sf.cglib.core.ClassEmitter.begin_class(ClassEmitter.java:77)
at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:173)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)
at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at com.centrain.exam.HibernateUtil.<clinit>(HibernateUtil.java:22)
at com.centrain.control.RegServlet.doGet(RegServlet.java:69)
at com.centrain.control.RegServlet.doPost(RegServlet.java:95)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)</coolcode>

经过各方资料查找,发现是spring 与hibernate集成的时候,两大框架jar包有冲突!

解决办法:

1.去掉类路径上的关于Hibernate的asm开头的jar包以及cglib-2.1.2.jar(可能版本不一样)
asm.jar
asm-attrs.jar
cglib-2.1.2.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

问题完美解决!

时间: 2024-10-06 14:45:18

java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V的相关文章

[spring] org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljav 解决

今天为java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V错误真花了我大量的时间去找这个问题,在网上也找到了不少的解决的办法,但不知道为什么不能解决我的问题,也不知道是不是我用的工具的问题哟,不过综合找到的现在终于找到了,虽然花了不少的时间,但还是很高兴,本来不想把

Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor

1.错误描写叙述 三月 15, 2015 6:50:23 下午 org.apache.catalina.core.StandardContext filterStart 严重: Exception starting filter struts2 java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor at org.apache.struts2.convention.PackageBasedActionConfigBuilder

Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.&lt;init&gt;(Z)V

启动web应用时出现以下异常: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(A

java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(Z)V

参考链接:https://blog.csdn.net/baicp3/article/details/13512237 参考链接https://blog.csdn.net/sinat_32034679/article/details/76572613?utm_source=blogxgwz5 除了以上链接中可能会出现的问题外,我这边是因为使用了多创建了相同名称的实体类,导致跳转url的时候报java.lang.NoSuchMethodError: org.objectweb.asm.ClassWr

使用CGlib出现java.lang.NoClassDefFoundError: org/objectweb/asm/Type异常【补充】

援引:使用CGlib出现java.lang.NoClassDefFoundError: org/objectweb/asm/Type异常 援引:class net.sf.cglib.core.DebuggingClassWriter has interface org.objectweb.asm.ClassVisitor as super class 源环境: IDE:IntelliJ IDEA 项目目的:测试动态代理 -- CGLIB 项目属性:Java Application 项目结构: 被

Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.commons.EmptyVisitor

1.错误叙述性说明 2014-7-13 1:45:53 org.apache.struts2.spring.StrutsSpringObjectFactory info 信息: ... initialized Struts-Spring integration successfully 2014-7-13 1:45:54 org.apache.catalina.core.StandardContext filterStart 严重: Exception starting filter strut

Hibernate异常:java.lang.NoClassDefFoundError: org/objectweb/asm/Type

解决方法:将Hibernate lib包下的asm.jar添加到项目的library中. 解决方法:将Hibernate lib包下的cglib-2.1.3.jar添加到项目的library中.  Hibernate异常:java.lang.NoClassDefFoundError: org/objectweb/asm/Type

Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/Type

问题描述 将项目挂载到 Myeclipse 的 tomcat 上,启动 tomcat ,报错"Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/Type" 问题原因 缺少 jar 包 解决方案 第一种方案: 1.将需要的第三方包拷贝进libs 文件夹. 2.将引用的第三方包,添加进工作的build path -->工程上右键 --

CGLib缺少jar出现 java.lang.ClassNotFoundException: org.objectweb.asm.Type

CGLib实现动态代理区别于JDK动态代理,不需要目标类实现任何接口,是通过生成代理类子类的方式,而且据说速度要快于JDK动态代理.所以我想要试验一下CGlib的动态代理,网上找了些例子,自己动手写了一个Demo,运行时抛出以下异常 这个异常说明的很清楚,因为使用了CGlib的Enhancer类,这个类用于为非接口类型创建一个Java代理,类里面使用了org.objectweb.asm.Type.ASM是一个字节码解析的工具,导入ASM的jar即可解决该问题,PS:如果使用Maven构建项目就不