Exception:
Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' sqlsessionfactory ' defined in Class path resource [Spring-mybatis.xml]: Error setting property values; Nested exception is org.springframework.beans.PropertyBatchUpdateException; Nested propertyaccessexceptions (1) are:
Propertyaccessexception 1:org.springframework.beans.methodinvocationexception:property ' DataSource ' threw exception Nested exception is java.lang.noclassdeffounderror:org/springframework/jdbc/datasource/ Transactionawaredatasourceproxy
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues ( abstractautowirecapablebeanfactory.java:1644)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean ( abstractautowirecapablebeanfactory.java:1352)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:582)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:502)
At Org.springframework.beans.factory.support.abstractbeanfactory.lambda$dogetbean$0 (AbstractBeanFactory.java : 312)
At Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:228)
At Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:310)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:200)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons ( defaultlistablebeanfactory.java:740)
At Org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization ( abstractapplicationcontext.java:868)
At Org.springframework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:549)
At Org.springframework.context.support.classpathxmlapplicationcontext.<init> ( classpathxmlapplicationcontext.java:144)
At Org.springframework.context.support.classpathxmlapplicationcontext.<init> ( CLASSPATHXMLAPPLICATIONCONTEXT.JAVA:85)
At Com.yxy.chukonu.test.dao.CustomerTest.createSessionTemplate (customertest.java:19)
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.junit.runners.model.frameworkmethod$1.runreflectivecall (frameworkmethod.java:50)
At Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:12)
At org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:47)
At Org.junit.internal.runners.statements.RunBefores.evaluate (runbefores.java:24)
At Org.junit.runners.ParentRunner.runLeaf (parentrunner.java:325)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:78)
At Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:57)
At Org.junit.runners.parentrunner$3.run (parentrunner.java:290)
At Org.junit.runners.parentrunner$1.schedule (parentrunner.java:71)
At Org.junit.runners.ParentRunner.runChildren (parentrunner.java:288)
At org.junit.runners.parentrunner.access$000 (parentrunner.java:58)
At Org.junit.runners.parentrunner$2.evaluate (parentrunner.java:268)
At Org.junit.runners.ParentRunner.run (parentrunner.java:363)
At Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (junit4testreference.java:86)
At Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:459)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (remotetestrunner.java:678)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:382)
At Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:192)
caused by:org.springframework.beans.PropertyBatchUpdateException; Nested propertyaccessexceptions (1) are:
Propertyaccessexception 1:org.springframework.beans.methodinvocationexception:property ' DataSource ' threw exception Nested exception is java.lang.noclassdeffounderror:org/springframework/jdbc/datasource/ Transactionawaredatasourceproxy
At Org.springframework.beans.AbstractPropertyAccessor.setPropertyValues (abstractpropertyaccessor.java:123)
At Org.springframework.beans.AbstractPropertyAccessor.setPropertyValues (abstractpropertyaccessor.java:77)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues ( abstractautowirecapablebeanfactory.java:1640)
... More
Solution:
Add followng dependency to Pom.xml.
<!--HTTPS://MVNREPOSITORY.COM/ARTIFACT/ORG.SPRINGFRAMEWORK/SPRING-JDBC--
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.0.1.RELEASE</version>
</dependency>