阅读 50

Mybatis 或者 数据库连接查询报错

用 mybatis-plus 插件自动生成的 selectByExample 或者 自己写的 sql 都会报错

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: 

Error creating bean with name ‘agvsCache‘: 
Invocation of init method failed; 
nested exception is org.mybatis.spring.MyBatisSystemException: 
nested exception is org.apache.ibatis.exceptions.PersistenceException: 

### Error querying database.  Cause: java.lang.NullPointerException
### The error may exist in cn/moviebook/wss/dao/recordmapper/TAgvMapper.xml
### The error may involve cn.moviebook.wss.dao.recordmapper.TAgvMapper.queryAllAgvs
### The error occurred while executing a query
### Cause: java.lang.NullPointerException

    2021-08-07 16:58:57.361  INFO 21356 --- [  restartedMain] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closed
2021-08-07 16:58:57.364  INFO 21356 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2021-08-07 16:58:57.374  INFO 21356 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug‘ enabled.
2021-08-07 16:58:57.394 ERROR 21356 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name ‘agvsCache‘: 
Invocation of init method failed; 
nested exception is org.mybatis.spring.MyBatisSystemException: 
nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.NullPointerException
### The error may exist in cn/moviebook/wss/dao/recordmapper/TAgvMapper.xml
### The error may involve cn.moviebook.wss.dao.recordmapper.TAgvMapper.queryAllAgvs
### The error occurred while executing a query
### Cause: java.lang.NullPointerException
  1. 去掉防火墙 wall 不管用

  2. 把 sql 直接写在 mapper 里面,不用 mybatis ,还是不管用

  3. 把 AGV 初始化 注释掉,只初始化其他的资源,还是不管用

这样就确定了不是 sql 的问题,而是 mybatis 的问题

继续看下面的错误报告

提到了 mybatismybatis-plus 于是更新一下 mybatis-plus 的插件到最新版本

解决

原文:https://www.cnblogs.com/icewalnut/p/15116357.html

文章分类
代码人生
版权声明:本站是系统测试站点,无实际运营。本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 XXXXXXo@163.com 举报,一经查实,本站将立刻删除。
相关推荐