Mybatis-plus报错:Error attempting to get column ‘createDate‘ from result set.
作者:互联网
Error attempting to get column 'createDate' from result set.
springboot项目,关于InvalidDataAccessApiUsageException: Error attempting to get column ‘createTime’ from result set. Cause: java.sql.SQLFeatureNotSupportedException ; null; nested exception is java.sql.SQLFeatureNotSupportedException的解决办法。
swagger测试接口报错:
{
"timestamp": "2021-05-03T06:49:19.496+00:00",
"status": 500,
"error": "Internal Server Error",
"message": "",
"path": "/system/cfg/pos/"
}
后端控制台报错:
Error attempting to get column 'createDate' from result set. Cause: java.sql.SQLFeatureNotSupportedException
; null; nested exception is java.sql.SQLFeatureNotSupportedException] with root cause
java.sql.SQLFeatureNotSupportedException: null
at com.alibaba.druid.pool.DruidPooledResultSet.getObject(DruidPooledResultSet.java:1771) ~[druid-1.1.10.jar:1.1.10]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]
报错原因
因为我在项目中使用了Mybati-plus,同时使用了druid数据源,由于druid数据源的版本太低,不支持JDK8中的LocalDate、LocalTime、LocalDateTime等日期类型,所以解决方案就是下载新版本的druid依赖。
解决方法
换用版本高于或等于1.1.21以上的jar包
<!--druid 数据源-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.21</version>
</dependency>
换用高版本的druid数据源
[
{
"id": 1,
"name": "技术总监",
"createDate": "2020-03-31",
"enabled": true
},
{
"id": 2,
"name": "运营总监",
"createDate": "2020-03-31",
"enabled": true
},
{
"id": 3,
"name": "市场总监",
"createDate": "2020-03-31",
"enabled": true
},
{
"id": 4,
"name": "研发工程师",
"createDate": "2020-03-31",
"enabled": true
},
{
"id": 5,
"name": "运维工程师",
"createDate": "2020-03-31",
"enabled": true
}
]
完美解决!!!!
标签:03,set,java,name,get,createDate,druid,报错 来源: https://blog.csdn.net/weixin_45630735/article/details/116376813