Announcement Announcement Module
Collapse
No announcement yet.
java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Hi people out there,
    I got a big problem, without knowing any solution.
    I at the beginning of working with spring and started out with a small project
    to get into that stuff.
    Now I am, or I just hope to be, near my target.
    But as I have mentioned in the topic-subject I got a problem with the
    cgilib.
    I am using the one from the spring-with-dependencies package, cleaned up
    my classpath and I am still getting this error:
    java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit
    The stack trace follows:
    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in resource [/WEB-INF/applicationContext.xml] of ServletContext: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(ILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
    java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(ILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
    	at net.sf.cglib.core.ClassEmitter.begin_class(ClassEmitter.java:63)
    	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:215)
    	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.hibernate.impl.SessionFactoryImpl.<clinit>&#40;SessionFactoryImpl.java&#58;236&#41;
    	at net.sf.hibernate.cfg.Configuration.buildSessionFactory&#40;Configuration.java&#58;791&#41;
    	at org.springframework.orm.hibernate.LocalSessionFactoryBean.newSessionFactory&#40;LocalSessionFactoryBean.java&#58;467&#41;
    	at org.springframework.orm.hibernate.LocalSessionFactoryBean.afterPropertiesSet&#40;LocalSessionFactoryBean.java&#58;405&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods&#40;AbstractAutowireCapableBeanFactory.java&#58;991&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;288&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;208&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;204&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;136&#41;
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons&#40;DefaultListableBeanFactory.java&#58;224&#41;
    	at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContext.java&#58;284&#41;
    	at org.springframework.web.context.support.XmlWebApplicationContext.refresh&#40;XmlWebApplicationContext.java&#58;131&#41;
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext&#40;ContextLoader.java&#58;156&#41;
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext&#40;ContextLoader.java&#58;97&#41;
    	at org.springframework.web.context.ContextLoaderServlet.init&#40;ContextLoaderServlet.java&#58;80&#41;
    	at javax.servlet.GenericServlet.init&#40;GenericServlet.java&#58;211&#41;
    	at org.apache.catalina.core.StandardWrapper.loadServlet&#40;StandardWrapper.java&#58;1019&#41;
    	at org.apache.catalina.core.StandardWrapper.load&#40;StandardWrapper.java&#58;862&#41;
    	at org.apache.catalina.core.StandardContext.loadOnStartup&#40;StandardContext.java&#58;3991&#41;
    	at org.apache.catalina.core.StandardContext.start&#40;StandardContext.java&#58;4335&#41;
    	at org.apache.catalina.core.ContainerBase.start&#40;ContainerBase.java&#58;1083&#41;
    	at org.apache.catalina.core.StandardHost.start&#40;StandardHost.java&#58;789&#41;
    	at org.apache.catalina.core.ContainerBase.start&#40;ContainerBase.java&#58;1083&#41;
    	at org.apache.catalina.core.StandardEngine.start&#40;StandardEngine.java&#58;478&#41;
    	at org.apache.catalina.core.StandardService.start&#40;StandardService.java&#58;476&#41;
    	at org.apache.catalina.core.StandardServer.start&#40;StandardServer.java&#58;2298&#41;
    	at org.apache.catalina.startup.Catalina.start&#40;Catalina.java&#58;556&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke&#40;Unknown Source&#41;
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;Unknown Source&#41;
    	at java.lang.reflect.Method.invoke&#40;Unknown Source&#41;
    	at org.apache.catalina.startup.Bootstrap.start&#40;Bootstrap.java&#58;284&#41;
    	at org.apache.catalina.startup.Bootstrap.main&#40;Bootstrap.java&#58;422&#41;
    I am a little bit confused, and don't know how to solve my problem.

    Hope you can help a bit.

    Thanks a lot Johannes Hiemer

  • #2
    You probably have an old version of asm.jar still around. cglib-full-2.0.2.jar already includes the asm classes, so check that no asm.jar or the like is around anymore.

    Juergen

    Comment


    • #3
      A JVM conflit its possible

      Hi!

      When I had this problem it's caused by a JVM conflit between an applicatition that use cglib-nodep-2.1_3 from asm.jar and other application that use other version.

      The class that I had a problem was org.objectweb.asm.ClassVisitor from Spring Framework (CGLIB NODEP).

      But had in the same environment a library Spring Framework (v.1.1.5).

      This Spring version depends with asm-2.2.3 version than ClassVisitor have follow signature:

      public abstract void visit(int i, int j, String s, String s1, String s2, String as[]);

      This signature is different that I was using for:
      public abstract void visit(int i, int j, String s, String s1, String as[], String s2);


      Than if the JVM classloader load first this class, asm-2.2.3 version than ClassVisitor, and my application try to use won't find-out the method ClassVisitor.visit with the needed signature, occurring a NoSuchMethodError.

      I could to run my application in an independent JVM.

      See my response: http://lucianodecarvalho.blogspot.co...thoderror.html

      Comment

      Working...
      X