`
zjx2388
  • 浏览: 1330876 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

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

    博客分类:
  • J2EE
阅读更多

 

MyEclipse 开发 SSH 整合时 java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit 解决方案
这篇文章解决了问题, 核心提示:

发现用 MyEclipse 7.0 做 Struts 1.3 + Spring 2.5+ Hibernate 3.2 整合时启动过程中报如下的错误:
javax.servlet.ServletException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\J2EE\Apache Software Foundation\Tomcat 6.0\webapps\ssh_chinamobile\WEB-INF\classes\applicationContext-base.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
 org.apache.struts.chain.ComposableRequestProcessor.process
(ComposableRequestProcessor.java:286)
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
 org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\J2EE\Apache Software Foundation\Tomcat 6.0\webapps\ssh_chinamobile\WEB-INF\classes\applicationContext-base.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1336)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
 java.security.AccessController.doPrivileged(Native Method)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
 org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
 org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
 com.ssh.action.LoginAction.execute(LoginAction.java:47)
 org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
 org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
 org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
 org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
 org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
 org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
 org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
 org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
 net.sf.cglib.core.ClassEmitter.begin_class(ClassEmitter.java:77)
 net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:173)
 net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
 net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
 net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
 net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
 net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
 net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
 net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
 org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)
 org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
 org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
 org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
 org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
 org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
 org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295)
 org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
 org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
 org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
 org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
 org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
 org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
 org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
 org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1367)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1333)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:471)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
 java.security.AccessController.doPrivileged(Native Method)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
 org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
 org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
 com.ssh.action.LoginAction.execute(LoginAction.java:47)
 org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
 org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
 org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
 org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
 org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
 org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
 org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
 org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

 

解决方案: 在GOOGLE上找着同样的问题。参考如下  
   Spring 和 Hibernate 共用的一些 jar 文件发生了版本冲突, 在spring Aop Libraries 下找到 org.objectweb.asm.ClassVisitor所在的jar包 (我电脑上asm包版本是 asm-2.2.3.jar).将其删除,然后重启 Tomcat.

 

 

分享到:
评论

相关推荐

    java.lang.NoSuchMethodError异常处理要点.doc

    在Java编程中,`java.lang.NoSuchMethodError`异常是一个运行时异常,通常发生在程序试图执行一个不存在的方法时。这个异常的出现通常意味着编译时和运行时的类版本不匹配,或者是在编译期间存在而运行时不存在的...

    maven3.6.3资源包

    1) Error injecting constructor, java.lang.NoSuchMethodError: org.apache.maven.model.validation.DefaultModelValidator: method 'void ()' not found at org.jetbrains.idea.maven.server.embedder....

    java.lang.NoSuchMethodError: javax/servlet/jsp/PageContext.getELContext()Ljavax/

    NULL 博文链接:https://albert0707.iteye.com/blog/562969

    解决 java.lang.NoSuchMethodError的错误

    解决 java.lang.NoSuchMethodError 的错误 Java.lang.NoSuchMethodError 错误是一种常见的 Java 异常,它发生在 Java 虚拟机 (JVM) 无法找到某个类的特定方法时。这种错误可能是由于项目依赖比较复杂、Java 运行...

    java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingExcepti

    jackson-annotations-2.10.2.jar jackson-core-2.10.2.jar jackson-databind-2.10.2.jar NoClassDefFoundError解决

    解决启动Azkaban报错问题:java.lang.NoSuchMethodError: com.google.common.collect.ImmutableMap.toImmutableMap

    在Java编程中,`NoSuchMethodError` 是一个常见的运行时异常,它表示在类加载时找到了该类,但在该类中却找不到特定方法的定义。这个问题通常发生在不同版本的库之间存在不兼容的情况,即在编译时使用的库版本包含了...

    java.lang.NoSuchMethodError异常解决

    在Java编程中,`java.lang.NoSuchMethodError`异常是一个运行时异常,通常发生在尝试执行一个在编译时可用但在运行时不可用的方法时。这个异常表明某个已经加载的类定义了一个方法,但该方法的实际行为无法被找到。...

    hibernate3.2+cglib2.2架包

    在Java中,有时我们可能会遇到`java.lang.NoSuchMethodError`,这通常发生在运行时尝试执行一个在编译时存在但在运行时不存在的方法。对于这个问题,CGlib提供了解决方案。CGlib使用ASM库(一个Java字节码操纵和分析...

    slf4j-1.7.rar

    1.如果运行程序出现错误:“Exception in thread "main...3.错误:“Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.MDC.getCopyOfContextMap()Ljava/util/Map”,这是因为jar包版本冲突造成的。

    xwork-core-2.3.37.jar

    用于解决struts2升级至2.3.37时 出现java.lang.NoSuchMethodError: com.opensymphony.xwork2.ActionContext.put(Ljava/lang/异常时,更换的xwork-core-2.3.37.jar

    Android 出现:java.lang.NoClassDefFoundError…错误解决办法

    在Android开发过程中,有时会遇到一个令人困惑的错误——`java.lang.NoClassDefFoundError`。这个错误通常意味着在运行时找不到某个类的定义,即使编译时该类是可用的。在本例中,问题出在一个特定的情景:在Android...

    jedis-3.3.0.jar

    java.lang.NoSuchMethodError: redis.clients.jedis.ScanResult.getStringCursor()Ljava/lang/String; at org.crazycake.shiro.WorkAloneRedisManager.keys(WorkAloneRedisManager.java:149) at org.crazycake....

    ubuntu下 AndroidStudio4.1启动报错问题的解决

    java.lang.NoSuchMethodError: com.intellij.ide.plugins.PluginManagerCore.loadDescriptors()[Lcom/intellij/ide/plugins/IdeaPluginDescriptorImpl; at com.a.a.b.b.ar.a(ar.java:121) at com.a.a.b.b.ar.a(ar....

    Android XmlResourceParser出错解决办法

    Android XmlResourceParser出错解决办法...java.lang.NoSuchMethodError: No interface method i()I in class Landroid/content/res/XmlResourceParser; or its super classes (declaration of 'android.content.res.Xm

    java web标签大全

    Java Web标签大全是一个涵盖广泛的资源,它集合了各种Web开发技术中的标签库,包括JSP、JSTL、Struts1、Struts2、JSF、FreeMarker、Spring和Velocity等。这些技术在构建动态、交互式的Web应用程序时起着至关重要的...

    java 异常种类总结【转】.docx

    java.lang.NoSuchMethodError 是一种方法不存在错误,指的是在程序中尝试调用某个类的方法,但是该类的定义中没有该方法的定义时抛出的异常。 27. java.lang.OutOfMemoryError 内存不足错误 java.lang....

    Hibernate经典版 通过图解让你轻松Hibernate

    Hibernate经典版 通过图解让你轻松学会Hibernate

    jboss-logging.jar,jboss-common.jar

    java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object; 错误解决办法

    配套的cglib和asm包

    因为在cglib简单使用的时候,和asm因为兼容问题运行老是失败。比如提示java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(I)V 之类的乱七八糟的错误。最后通过使用正确的配套的版本使得程序成功运行。

    java 图书管理系统

    登陆报错的问题 登录 java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I 问题 导入数据库乱码解决方案: 人才管理系统项目详细文档说明 ========================================= 系统安装...

Global site tag (gtag.js) - Google Analytics