druid设置数据源报错类型不支持Cause: java.lang.IllegalStateException: dbType not support

今天,启动了下项目 居然发现 进行SQL查询时候报错,错误原因如下 

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.IllegalStateException: dbType not support : null, url null
### The error may exist in com/*****/*****/dao/mapper/SerialNumberMapper.java (best guess)
### The error may involve com.*****.*****.dao.mapper.SerialNumberMapper.findSerialNumberByPerfix
### The error occurred while executing a query
### Cause: java.lang.IllegalStateException: dbType not support : null, url null
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) ~[mybatis-spring-1.3.1.jar:1.3.1]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) ~[mybatis-spring-1.3.1.jar:1.3.1]
at com.sun.proxy.$Proxy69.selectOne(Unknown Source) ~[na:na]
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166) ~[mybatis-spring-1.3.1.jar:1.3.1]
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82) ~[mybatis-3.4.5.jar:3.4.5]
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) ~[mybatis-3.4.5.jar:3.4.5]
at com.sun.proxy.$Proxy119.findSerialNumberByPerfix(Unknown Source) ~[na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_79]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at com.sun.proxy.$Proxy120.findSerialNumberByPerfix(Unknown Source) ~[na:na]
at com.iqurong.new51.app.schedule.PushBorrowBid.getSerialNumber(PushBorrowBid.java:491) ~[classes/:na]
at com.iqurong.new51.app.schedule.PushBorrowBid.getParamMap(PushBorrowBid.java:385) ~[classes/:na]
at com.iqurong.new51.app.schedule.PushBorrowBid.saveBidLog(PushBorrowBid.java:333) ~[classes/:na]
at com.iqurong.new51.app.schedule.PushBorrowBid.pushBorrowBidTask(PushBorrowBid.java:84) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_79]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at java.util.concurrent.Executors$RunnableAdapter.call$$$capture(Executors.java:471) [na:1.7.0_79]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java) [na:1.7.0_79]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_79]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_79]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]

at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]

。。。。。突然 发现 就是一条很简单的SQL 怎么会出问题 问题产生点 这个位置排除 第二步 springboot 配置文件中 

发现 数据源的一些 配置都注释 MMP啊 (第一次 都没看出来 ,第二次 同事提醒 哎 老眼昏花 看不清了 )

但是呢 项目启动没报错呢 

druid设置数据源报错类型不支持Cause: java.lang.IllegalStateException: dbType not support_第1张图片

因为配置文件中 的数据源配置都被注释掉了 所有初始化是 都将这些值设置成空 了 故 进行SQL查询 报异常

问题如图 这个 yml中配置文件 被注释掉了 so 查询失败 

druid设置数据源报错类型不支持Cause: java.lang.IllegalStateException: dbType not support_第2张图片

将这些注释清除后 ,问题圆满解决

druid设置数据源报错类型不支持Cause: java.lang.IllegalStateException: dbType not support_第3张图片

查询成功

你可能感兴趣的:(java,mysql)