Topic: Causes and solutions for exceptions arising from org.springframework.beans.factory.BeanCreationException (jar packages in Hibernate and jar pack conflicts in spring). __jar

Source: Internet
Author: User
Tags addchild

Topic: The causes of org.springframework.beans.factory.BeanCreationException anomalies and solutions.


Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' dataSource ' defined in ServletContext

Resource [/web-inf/applicationcontext.xml]: instantiation of Bean failed; Nested exception is java.lang.NoClassDefFoundError:

Org/apache/commons/pool/impl/genericobjectpool
caused By:java.lang.noclassdeffounderror:org/apache/commons/pool/impl/genericobjectpool
At Java.lang.Class.getDeclaredConstructors0 (Native method)
At Java.lang.Class.privateGetDeclaredConstructors (Unknown Source)
At Java.lang.Class.getConstructor0 (Unknown Source)
At Java.lang.Class.getDeclaredConstructor (Unknown Source)
At Org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate

(simpleinstantiationstrategy.java:54)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean

(abstractautowirecapablebeanfactory.java:752)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance

(abstractautowirecapablebeanfactory.java:717)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean

(abstractautowirecapablebeanfactory.java:386)
At Org.springframework.beans.factory.support.abstractbeanfactory$1.getobject (abstractbeanfactory.java:249)
At Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton

(defaultsingletonbeanregistry.java:155)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:246)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:160)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons

(defaultlistablebeanfactory.java:291)
At Org.springframework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:352)
At Org.springframework.web.context.ContextLoader.createWebApplicationContext (contextloader.java:245)
At Org.springframework.web.context.ContextLoader.initWebApplicationContext (contextloader.java:188)
At Org.springframework.web.context.ContextLoaderListener.contextInitialized (contextloaderlistener.java:49)
At Org.apache.catalina.core.StandardContext.listenerStart (standardcontext.java:3934)
At Org.apache.catalina.core.StandardContext.start (standardcontext.java:4429)
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:526)
At Org.apache.catalina.startup.HostConfig.deployDirectory (hostconfig.java:987)
At Org.apache.catalina.startup.HostConfig.deployDirectories (hostconfig.java:909)
At Org.apache.catalina.startup.HostConfig.deployApps (hostconfig.java:495)
At Org.apache.catalina.startup.HostConfig.start (hostconfig.java:1206)
At Org.apache.catalina.startup.HostConfig.lifecycleEvent (hostconfig.java:314)
At Org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (lifecyclesupport.java:119)
At Org.apache.catalina.core.ContainerBase.start (containerbase.java:1053)
At Org.apache.catalina.core.StandardHost.start (standardhost.java:722)
At Org.apache.catalina.core.ContainerBase.start (containerbase.java:1045)
At Org.apache.catalina.core.StandardEngine.start (standardengine.java:443)
At Org.apache.catalina.core.StandardService.start (standardservice.java:516)
At Org.apache.catalina.core.StandardServer.start (standardserver.java:710)
At Org.apache.catalina.startup.Catalina.start (catalina.java:583)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown Source)
At Java.lang.reflect.Method.invoke (Unknown Source)
At Org.apache.catalina.startup.Bootstrap.start (bootstrap.java:288)
At Org.apache.catalina.startup.Bootstrap.main (bootstrap.java:413)
2009-10-28 16:14:57 Org.apache.catalina.core.Standa Ror Listenerstart

The reason this exception is generated:
Because of the bundle conflict that arises when the spring framework and the Hibernate framework are consolidated, the bug begins to occur at myeclipse6.0, two of the conflict

A. jar file is the result of a conflict between Asm.jar and Asm-2.2.3.jar.

Solution: The video says that removing Asm-2.2.3.jar can work correctly.
But I have been in my machine after the deletion, but has always been reported above the error: Org.springframework.beans.factory.BeanCreationException:Error creating

Bean with Name ' DataSource ' defined in ServletContext resource [/web-inf/applicationcontext.xml]: Instantiation of Bean

Failed Nested exception is Java.lang.noclassdeffounderror:org/apache/commons/pool/impl/genericobjectpool

Later I went to my lib directory and deleted a lot of names similar to the. jar file (delete can have 5, 6. jar files) But it's still the wrong one.


Next went to watch the video, looking for clues, suddenly found that I used myeclipse6.1,hibernate only support to 3.1, and the video is used myeclipse6.5, support to

hibernate3.2, so on the Internet to download the myeclipse6.5, after installation, and a new project, the previous project related documents are copied over (because. jar files are different, the

In front of that project is not directly used, and deployed after the project, is really a high version of the function of the whole, reported that the fault is more targeted.

Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' sessionfactory ' defined in

ServletContext resource [/web-inf/applicationcontext.xml]: Invocation of Init method failed; Nested exception is

Java.io.FileNotFoundException:class path Resource [Com.oristand.bean.User.hbm.xml] cannot is opened because it does not

Exist
caused By:java.io.FileNotFoundException:class path resource [Com.oristand.bean.User.hbm.xml] cannot be opened because It

does not exist

Analysis errors were found to be:
<property name= "Mappingresources" >
<list>
<value>com.oristand.bean.User.hbm.xml</value>
</list>
</property>

To
<property name= "Mappingresources" >
<list>
<value>com/oristand/bean/User.hbm.xml</value>
</list>
</property>

Deploy again: Again the following error, more exciting:
Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' sessionfactory ' defined in

ServletContext resource [/web-inf/applicationcontext.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
caused By:java.lang.NoSuchMethodError:org.objectweb.asm.ClassVisitor.visit (iiljava/lang/string; ljava/lang/string;

[Ljava/lang/string; ljava/lang/string;) V

Then remove the corresponding Asm-2.2.3.jar and deploy again,

It worked......................

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.