问答详情
源自:8-2 整合MyBatis - 实现基于mybatis的CRUD功能

java.lang.NoSuchMethodException: tk.mybatis.mapper.provider.base.BaseInsertProvider.

https://img2.mukewang.com/5af44ee6000187c717910799.jpg

大兄弟们,你们有谁遇到这个错误吗?

提问者:慕粉2051555640 2018-05-10 21:54

个回答

  • 易水难求
    2018-12-05 10:59:00

    如果配置了数据源不能连接,报这个

    {

        "timestamp": "2018-12-05T02:54:43.951+0000",

        "status": 500,

        "error": "Internal Server Error",

        "message": "nested exception is org.apache.ibatis.exceptions.PersistenceException: \r\n### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.\r\n### The error may exist in com/imooc/mapper/UsersMapper.java (best guess)\r\n### The error may involve com.imooc.mapper.UsersMapper.selectOne\r\n### The error occurred while executing a query\r\n### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.",


    }

    就去检查数据源配置信息

  • 飞上天de猪
    2018-06-27 10:39:39

    导入org.mybatis.spring.annotation.MapperScan服务器报和你一样的错,换成tk.mybatis.spring.annotation.MapperScan,服务器响应超级慢,然后最后报个500

  • 慕粉2051555640
    2018-05-14 10:56:16

    https://img.mukewang.com/5af8fa1b0001f18009150297.jpg

    https://img4.mukewang.com/5af8fa1b00013fa409500572.jpg

    在项目中搜索BaseInsertProvider 这个类,发现只有

    tk.mybatis.spring.annotation.MapperScan

    这个包中有,改为导入该类。


  • 庆宝宝
    2018-05-11 22:58:36

    把SpringBoot的Application启动类的@MapperScan注解导入包换成import org.mybatis.spring.annotation.MapperScan;试一下