创建名为"transactionManager"的 bean 时出错:嵌套异常是 java.lang.NoClassDefFoundError: org/springframework/jdbc/da


严重:上下文初始化失败org.springframework.beans.factory.BeanCreationException:创建ServletContext资源[/WEB-INF/springrest servlet.xml]中定义的名称为"transactionManager"的bean时出错:调用init方法失败;嵌套异常是java.lang.NoClassDefFoundError:org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)网址:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)网址:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)网址:org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)位于org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)位于org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)网址:org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)位于org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)位于org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)网址:org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)网址:org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:667)网址:org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:633)网址:org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:681)网址:org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:552)网址:org.springframework.web.servlet.FrameworkServlet.initServlet Bean(FrameworkServlet.java:493)网址:org.springframework.web.servlet.HttpServlet Bean.init(HttpServlet Bean.java:136)位于javax.servlet.GenericServlet.init(GenericServlet.java:158)网址:org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1194)网址:org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1110)网址:org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1000)网址:org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4901)网址:org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5211)网址:org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)网址:org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403)网址:org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)位于java.util.concurrent.FFutureTask.run(FutureTask.java:266)位于java.util.concurrent.ThreadPoolExecutiator.runWorker(ThreadPoolExecutiator.java:1142)位于java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)在java.lang.Thread.run(线程.java:745)原因:java.lang.NoClassDefFoundError:org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy位于org.springframework.orm.hibernate5.Hibernate TransactionManager.setDataSource(Hibernate TransactionManager.java:186)位于org.springframework.om.hibernate5.Hibernate TransactionManager.afterPropertiesSet(Hibernate TransactionManager.java:360)网址:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)…还有28个引起原因:java.lang.ClassNotFoundException:org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy网址:org.apache.catalina.loarder.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1274)网址:org.apache.catalina.loarder.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1108)…还有32个

2016年7月20日上午6:47:50 org.apache.catalina.core.ApplicationContext日志严重:标准包装。可抛出org.springframework.beans.factory.BeanCreationException:创建ServletContext资源[/WEB-INF/springrest servlet.xml]中定义的名称为"transactionManager"的bean时出错:调用init方法失败;嵌套异常是java.lang.NoClassDefFoundError:org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)网址:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)网址:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)网址:org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)位于org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)位于org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)网址:org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)位于org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)位于org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)网址:org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)网址:org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:667)网址:org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:633)网址:org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:681)网址:org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:552)网址:org.springframework.web.servlet.FrameworkServlet.initServlet Bean(FrameworkServlet.java:493)网址:org.springframework.web.servlet.HttpServlet Bean.init(HttpServlet Bean.java:136)位于javax.servlet.GenericServlet.init(GenericServlet.java:158)网址:org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1194)网址:org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1110)网址:org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1000)网址:org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4901)网址:org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5211)网址:org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)网址:org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403)网址:org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)位于java.util.concurrent.FFutureTask.run(FutureTask.java:266)位于java.util.concurrent.ThreadPoolExecutiator.runWorker(ThreadPoolExecutiator.java:1142)位于java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)在java.lang.Thread.run(线程.java:745)原因:java.lang.NoClassDefFoundError:org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy位于org.springframework.orm.hibernate5.Hibernate TransactionManager.setDataSource(Hibernate TransactionManager.java:186)位于org.springframework.om.hibernate5.Hibernate TransactionManager.afterPropertiesSet(Hibernate TransactionManager.java:360)网址:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)位于org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)…还有28个引起原因:java.lang.ClassNotFoundException:org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy网址:org.apache.catalina.loarder.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1274)网址:org.apache.catalina.loarder.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1108)…还有32个

确保类路径中有org.springframework.jdbc-XX.jar。如果你正在使用maven或gradle编译/构建你的应用程序,请在依赖项中声明它。。。

Maven:

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.1.RELEASE</version>
</dependency>

等级:

compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework:spring-jdbc")

根据需要更改版本发布。

相关内容

  • 没有找到相关文章

最新更新