title: Error : java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V
body: <p>I am developing a small Spring application. I have to store the details of the student information in the database. I have developed one SimpleFormController. I have used NetBeans + Hibernate mapping + Spring. When I deploy the project, the following errors occurs.</p>
  
  <p><strong>My spring-config-db-applicationContext.xml is shown below:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
  "http://www.springframework.org/dtd/spring-beans.dtd"&gt;
  &lt;beans&gt;
  &lt;!-- Hibernate session factory --&gt;
    &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;constructor-arg index="0"&gt;
          &lt;value&gt;${driverClassName}&lt;/value&gt;
      &lt;/constructor-arg&gt;
      &lt;constructor-arg index="1"&gt;
          &lt;value&gt;${url}&lt;/value&gt;
      &lt;/constructor-arg&gt;
      &lt;constructor-arg index="2"&gt;
          &lt;value&gt;${username}&lt;/value&gt;
      &lt;/constructor-arg&gt;
      &lt;constructor-arg index="3"&gt;
          &lt;value&gt;${password}&lt;/value&gt;
      &lt;/constructor-arg&gt;
    &lt;/bean&gt;
  
  
    &lt;bean id="sessionFactory"  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource"&gt;
          &lt;ref bean="dataSource"/&gt;
      &lt;/property&gt;
      &lt;!-- &lt;property name="configLocation"&gt;
          &lt;value&gt;WEB-INF/classes/hibernate.cfg.xml&lt;/value&gt;
      &lt;/property&gt; --&gt;
      &lt;property  name="mappingResources" &gt;
          &lt;list&gt;
              &lt;value&gt;hibernate.cfg.xml&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  
    &lt;!--  &lt;property  name="configurationClass"&gt;
          &lt;value&gt;org.hibernate.cfg.AnnotationConfiguration&lt;/value&gt;
      &lt;/property&gt; --&gt;
  
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;${dialect}&lt;/prop&gt;
              &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
    &lt;!--&lt;prop key="hibernate.hbm2ddl.auto"&gt;create&lt;/prop&gt;--&gt;
          &lt;/props&gt;
      &lt;/property&gt;
    &lt;/bean&gt;
    &lt;bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"&gt;
      &lt;property name="sessionFactory"&gt;
          &lt;ref bean="sessionFactory"/&gt;
      &lt;/property&gt;
    &lt;/bean&gt;
    &lt;bean id="transactionManager"  class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
      &lt;property name="sessionFactory"&gt;
          &lt;ref bean="sessionFactory"/&gt;
      &lt;/property&gt;
    &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>Following error is occurs:</strong></p>
  
  <pre><code>ERROR (org.springframework.web.context.ContextLoader:213) - Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [jndi:/localhost/Student/WEB-INF/classes/config/spring-db-applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.&lt;init&gt;(I)V
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1395)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:289)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:286)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:526)
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:730)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:387)
          at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:270)
          at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
          at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
          at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
          at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
          at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
          at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
          at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
          at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:511)
          at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1231)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
          at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
          at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1471)
          at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:824)
          at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:350)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:196)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          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:191)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
          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:286)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Thread.java:619)
  Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.&lt;init&gt;(I)V
          at net.sf.cglib.core.DebuggingClassWriter.&lt;init&gt;(DebuggingClassWriter.java:47)
          at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)
          at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
          at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
          at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144)
          at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:116)
          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.&lt;clinit&gt;(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.&lt;init&gt;(AbstractEntityTuplizer.java:135)
          at org.hibernate.tuple.entity.PojoEntityTuplizer.&lt;init&gt;(PojoEntityTuplizer.java:55)
          at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.&lt;init&gt;(EntityEntityModeToTuplizerMapping.java:56)
          at org.hibernate.tuple.entity.EntityMetamodel.&lt;init&gt;(EntityMetamodel.java:302)
          at org.hibernate.persister.entity.AbstractEntityPersister.&lt;init&gt;(AbstractEntityPersister.java:434)
          at org.hibernate.persister.entity.SingleTableEntityPersister.&lt;init&gt;(SingleTableEntityPersister.java:108)
          at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:61)
          at org.hibernate.impl.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:238)
          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1304)
          at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:813)
          at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:731)
          at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1454)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1392)
          ... 48 more
  Mar 12, 2010 5:32:28 PM org.apache.catalina.core.StandardContext start
  SEVERE: Error listenerStart
  </code></pre>