Recent projects have been reported
caused by:java.lang.nosuchmethoderror:org.objectweb.asm.classwriter.<init> (Z) V
This error, the Internet found some solutions, but did not work. Later found an article in other places, found that the effect is good, here to share a solution.
First, the error is as follows:
Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' mysessionfactory ' defined in Class path resource [Applicationcontext.xml]: Invocation of Init method failed; Nested exception is java.lang.nosuchmethoderror:org.objectweb.asm.classwriter.<init> (Z) V at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1338) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:473) at Org.springframework.beans.factory.support.abstractautowirecapablebeanfactory$1.run ( abstractautowirecapablebeanfactory.java:409) at Java.security.AccessController.doPrivileged (Native method) at Org. Springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:380) at org.springframework.beans.factory.support.abstractbeanfactory$1. GetobjecT (abstractbeanfactory.java:264) at Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:222) at Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:261) at Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:185) at Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:164) at Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons ( defaultlistablebeanfactory.java:423) at Org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization ( abstractapplicationcontext.java:728) at Org.springframework.context.support.AbstractApplicationContext.refresh ( abstractapplicationcontext.java:380) at Org.springframework.web.context.ContextLoader.createWebApplicationContext (contextloader.java:255) at ORG.SPRINGFRamework.web.context.ContextLoader.initWebApplicationContext (contextloader.java:199) at Org.springframework.web.context.ContextLoaderListener.contextInitialized (contextloaderlistener.java:45) at Org.apache.catalina.core.StandardContext.listenerStart (standardcontext.java:4992) at Org.apache.catalina.core.StandardContext.startInternal (standardcontext.java:5490) at Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:150) at Org.apache.catalina.core.ContainerBase.addChildInternal (containerbase.java:901) at Org.apache.catalina.core.ContainerBase.addChild (containerbase.java:877) at Org.apache.catalina.core.StandardHost.addChild (standardhost.java:649) at Org.apache.catalina.startup.HostConfig.deployDirectory (hostconfig.java:1247) at Org.apache.catalina.startup.hostconfig$deploydirectory.run (hostconfig.java:1898) at Java.util.concurrent.executors$runnableadapter.call (executors.java:441) at java.util.concurrent.futuretask$ Sync.innerrun (Futuretask.java:303) at Java.util.concurrent.FutureTask.run (futuretask.java:138) at java.util.concurrent.ThreadPoolEx Ecutor$worker.runtask (threadpoolexecutor.java:886) at Java.util.concurrent.threadpoolexecutor$worker.run ( threadpoolexecutor.java:908) at Java.lang.Thread.run (thread.java:619) caused by:java.lang.NoSuchMethodError: Org.objectweb.asm.classwriter.<init> (Z) V at net.sf.cglib.core.debuggingclasswriter.<init> ( 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:145) at Net.sf.cglib.core.KeyFactory.create (keyfactory.java:117) at the Net.sf.cglib.core.KeyFactory.create (keyfactory.java:108) at Net.sf.cglib.core.KeyFactory. CReate (keyfactory.java:104) at the 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:302) 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 or G.hibernate.cfg.configuration.buildsessionfactory (configuration.java:1300) at
Org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory (localsessionfactorybean.java:814) At Org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory (Localsessionfactorybean.java : 732) at Org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet ( abstractsessionfactorybean.java:211) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods ( abstractautowirecapablebeanfactory.java:1369) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1335) ... More 2015-5-21 16:44:08 Org.apachE.catalina.core.standardcontext Listenerstart Serious: Exception sending context initialized event to listener instance of Clas S Org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating Bean with Name ' mysessionfactory ' defined in class path resource [Applicationcontext.xml]: Invocation of It method failed; Nested exception is java.lang.nosuchmethoderror:org.objectweb.asm.classwriter.<init> (Z) V at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1338) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:473) at Org.springframework.beans.factory.support.abstractautowirecapablebeanfactory$1.run ( abstractautowirecapablebeanfactory.java:409) at Java.security.AccessController.doPrivileged (Native method) at Org. Springframework.beans.factory.Support. Abstractautowirecapablebeanfactory.createbean (abstractautowirecapablebeanfactory.java:380) at Org.springframework.beans.factory.support.abstractbeanfactory$1.getobject (abstractbeanfactory.java:264) at Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:222) at Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:261) at Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:185) at Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:164) at Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons ( defaultlistablebeanfactory.java:423) at Org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization ( abstractapplicationcontext.java:728) at Org.springframework.context.support.AbstractApplicatiOncontext.refresh (abstractapplicationcontext.java:380) at Org.springframework.web.context.ContextLoader.createWebApplicationContext (contextloader.java:255) at Org.springframework.web.context.ContextLoader.initWebApplicationContext (contextloader.java:199) at Org.springframework.web.context.ContextLoaderListener.contextInitialized (contextloaderlistener.java:45) at Org.apache.catalina.core.StandardContext.listenerStart (standardcontext.java:4992) at Org.apache.catalina.core.StandardContext.startInternal (standardcontext.java:5490) at Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:150) at Org.apache.catalina.core.ContainerBase.addChildInternal (containerbase.java:901) at Org.apache.catalina.core.ContainerBase.addChild (containerbase.java:877) at Org.apache.catalina.core.StandardHost.addChild (standardhost.java:649) at Org.apache.catalina.startup.HostConfig.deployDirectory (hostconfig.java:1247) at Org.apache.catalina.startup.HostConfig$DeployDirectory. Run (hostconfig.java:1898) at Java.util.concurrent.executors$runnableadapter.call (Executors.java : 441) at Java.util.concurrent.futuretask$sync.innerrun (futuretask.java:303) at Java.util.concurrent.FutureTask.run (futuretask.java:138) at Java.util.concurrent.threadpoolexecutor$worker.runtask (threadpoolexecutor.java:886) at Ja Va.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:908) at Java.lang.Thread.run ( thread.java:619) caused by:java.lang.nosuchmethoderror:org.objectweb.asm.classwriter.<init> (Z) V at Net.sf.cglib.core.debuggingclasswriter.<init> (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:145) at Net.sf.cglib.core.KeyFactory.create (keyfactory.java:117) at Net.sf.cglib.core.KeyFactory.create (Ke yfactory.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:302) 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:1300) at
Org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory (localsessionfactorybean.java:814) At Org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory (Localsessionfactorybean.java : 732) at Org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet ( abstractsessionfactorybean.java:211) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods ( abstractautowirecapablebeanfactory.java:1369) at Org.Springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1335) ... More
Solution:
When you use spring's AOP programming, you'll use these Lib:asm-2.2.3.jar Asm-commons-2.2.3.jar Asm-util-2.2.3.jar hibernate use if Lib:asm.jar a Sm-attrs.jar where Asm-2.2.3.jar and Asm.jar exist class conflicts ... Using either or both of these may cause the following error: Java.lang.noclassdeffounderror:org/objectweb/asm/codevisitor Java.lang.noclassdeffounderror:org/objectweb/asm/commons/emptyvisitor Java.lang.NoSuchMethodError: Org.objectweb.asm.ClassVisitor.visit ... The solution is: 1. Remove the 3 lib Asm.jar asm-attrs.jar Cglib-2.1.3.jar 2 on the classpath for hibernate. Save the following 4 Lib Asm-2.2.3.jar in spring Asm-commons-2.2.3.jar Asm-util-2.2.3.jar Cglib-nodep-2.1_3.jar Another solution
Get rid of the Asm-2.2.3.jar in spring
Here, I'm using two methods: directly delete the Asm.jar in spring, and then the project starts smoothly. Finally solved it.