mybatis+spring报错PropertyAccessException 1: org.springframework.beans.MethodInvocationException
报错如下:
*
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name ‘dataSource’ defined in class path resource
[applicationContext.xml]: Error setting property values; nested
exception is org.springframework.beans.PropertyBatchUpdateException;
nested PropertyAccessExceptions (1) are: PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
‘driverClassName’ threw exception; nested exception is
java.lang.IllegalStateException: Could not load JDBC driver class
[com.mysql.jdbc.Driver]
*
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access2.evaluate(ParentRunner.java:184)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property ‘driverClassName’ threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)
… 37 more
解决方案:原来是mysql的jar包忘记放了,,,,,放上了就OK,大家以后一定得注意细心。别犯这么低级的错误了
相关文章
- spring boot自动配置原理面试题_Spring boot面试
- Spring 全家桶之 Spring Web MVC(七)- Interceptor
- Spring框架:第五章:Spring EL表达式
- MyBatis——【第三章】管理关系映射及spring集成
- Spring Cloud:第五章:Zuul服务网关
- 【06】Spring源码-分析篇-ApplicationContext
- 解释spring框架中bean的生命周期_Spring bean的生命周期
- spring boot整合shiro_Spring框架介绍及使用
- 跟着Spring大厂学抽象
- Spring监听器-spring源码详解(五)
- SpringBoot|Spring-Data-Redis 验证码短信存储服务
- Spring Boot的性能优化(三)
- 自定义Spring Cloud Sleuth的跟踪信息
- 【愚公系列】2023年04月 Java教学课程 131-Spring框架的简介和基本使用
- Spring Cloud LoadBalancer 的高级特性-客户端负载均衡策略
- Spring Batch 配置方式XML
- spring的AOP(四)—-Spring AOP 编程(Advisor)详解编程语言
- Spring Boot2.0之Admin-UI分布式微服务监控中心详解编程语言
- spring boot应用启动原理分析详解编程语言
- Spring Boot(十四):spring boot整合shiro-登录认证和权限管理详解编程语言
- Spring Boot(十三):spring boot小技巧详解编程语言
- Spring Boot(五):spring data jpa的使用详解编程语言
- spring使用Spring整合Redis和Jedis构建高性能应用(redisjedis与)
- Spring整合Redis简单实现高效缓存(spring集成redis)