org.springframework.beans.factory.BeanCreationException:创建名称为' userDao'的bean时出错在ServletContext资源

时间:2016-04-14 20:24:36

标签: spring maven eclipselink jpa-2.0 tomcat8

我正面临着bean的初始化失败;嵌套异常是java.lang.NoClassDefFoundError:org / eclipse / persistence / internal / weaving / PersistenceWeaved。 看起来Maven依赖项中存在库冲突。

一些依赖项是:

org.eclipse.persistence:eclipselink:2.1.02
org.eclipse.persistence:javax.persistence:2.0.12
org.glassfish:javax.faces:2.2.7

我更改了eclipse链接和JSF版本的版本,之后我从here添加了对这个缺少的类(org / eclipse / persistence / internal / weaving / PersistenceWeaved)的依赖。

尚未解决我的问题。

我已阅读下面的这个问题

org.springframework.beans.factory.BeanCreationException: Error creating bean with name https://community.oracle.com/thread/2545395?db=5

我已经在谷歌等方面做了很多研究,但我不能很好地回答我的问题,而且我已经看到了更多有相同问题的人问题或almost the same

  

org.springframework.beans.factory.BeanCreationException:创建名称为' userDao'的bean时出错在ServletContext资源[/WEB-INF/bootstrap-context.xml]中定义:bean的初始化失败;嵌套异常是java.lang.NoClassDefFoundError:org / eclipse / persistence / internal / weaving / PersistenceWeaved     在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)     在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)     在org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:294)     在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)     在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)     在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:605)     在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472)     在org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)     在org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)     在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4811)     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5251)     在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)     在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)     在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)     在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)     在org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1696)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:497)     at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)     at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)     at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:484)     at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:433)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:497)     at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)     at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)     在javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)     在javax.management.remote.rmi.RMIConnectionImpl.access $ 300(RMIConnectionImpl.java:76)     at javax.management.remote.rmi.RMIConnectionImpl $ PrivilegedOperation.run(RMIConnectionImpl.java:1309)     在javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)     在javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:497)     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)     at sun.rmi.transport.Transport $ 1.run(Transport.java:200)     at sun.rmi.transport.Transport $ 1.run(Transport.java:197)     at java.security.AccessController.doPrivileged(Native Method)     at sun.rmi.transport.Transport.serviceCall(Transport.java:196)     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)     at sun.rmi.transport.tcp.TCPTransport $ ConnectionHandler.run0(TCPTransport.java:826)     at sun.rmi.transport.tcp.TCPTransport $ ConnectionHandler.lambda $ run $ 256(TCPTransport.java:683)     at java.security.AccessController.doPrivileged(Native Method)     at sun.rmi.transport.tcp.TCPTransport $ ConnectionHandler.run(TCPTransport.java:682)     在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)     在java.lang.Thread.run(Thread.java:745)   引起:java.lang.NoClassDefFoundError:org / eclipse / persistence / internal / weaving / PersistenceWeaved     at java.lang.ClassLoader.defineClass1(Native Method)     at java.lang.ClassLoader.defineClass(ClassLoader.java:760)     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)     在org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2503)     在org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:831)     在org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1274)     在org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139)     at java.lang.Class.forName0(Native Method)     在java.lang.Class.forName(Class.java:348)     at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)     at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)     at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)     at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)     at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)     at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)     at sun.reflect.generics.repository.MethodRepository.getReturnType(MethodRepository.java:68)     at java.lang.reflect.Method.getGenericReturnType(Method.java:255)     at java.lang.reflect.Method.specificToGenericStringHeader(Method.java:419)     at java.lang.reflect.Executable.sharedToGenericString(Executable.java:163)     at java.lang.reflect.Method.toGenericString(Method.java:414)     在java.beans.MethodRef.set(MethodRef.java:46)     at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:117)     在java.beans.MethodDescriptor。(MethodDescriptor.java:72)     在java.beans.MethodDescriptor。(MethodDescriptor.java:56)     at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1205)     在java.beans.Introspector.getBeanInfo(Introspector.java:426)     在java.beans.Introspector.getBeanInfo(Introspector.java:173)     在org.springframework.beans.CachedIntrospectionResults。(CachedIntrospectionResults.java:224)     在org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:149)     在org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:324)     在org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:331)     在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1242)     在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1101)     在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)     ......还有56个   引起:java.lang.ClassNotFoundException:org.eclipse.persistence.internal.weaving.PersistenceWeaved     在org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)     在org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1139)     ......还有90多个

1 个答案:

答案 0 :(得分:0)

请将此org.eclipse.persistence:eclipselink:2.1.02 jar文件添加到apache tomcat文件夹中的lib文件夹中。 这解决了Apache Tomcat 8.0.33上的这个问题。