错误分析:由于每一个Mapper.xml都需要在mybatis核心配置文件中注册

解决方法:

①检测mapper是否声明
在mybatis-config.xml配置文件中添加下面几行代码(注意路径一定要填写正确,按照com/lyp/dao/UserMapper.xml 的格式进行填写)

 <mappers><mapper resource="com/lyp/dao/UserMapper.xml"/></mappers>

②在当前pom.xml中加入以下代码
(原因:maven由于他的约定大于配置,因此我们写的配置文件可能会出现无法被导出或者生效的问题)

<build><resources><resource><directory>src/main/java</directory><includes><include>**/*.properties</include><include>**/*.xml</include></includes><filtering>true</filtering></resource><resource><directory>src/main/resources</directory><includes><include>**/*.properties</include><include>**/*.xml</include></includes><filtering>true</filtering></resource></resources></build>

③检查id是否正确(是否与自己定义的方法名一致)

   <insert id="insertUser" parameterType="user">insert into user (id,name,pwd) values (#{id},#{name},#{pwd});</insert>

④检查mapper命名空间是否正确

<mapper namespace="com.lyp.dao.UserMapper">

⑤若还不行,检查xml配置文件中是否还有空格,有空格也会报错!!!

初学mybatis时出现 org.apache.ibatis.binding.BindingException报错相关推荐

  1. mybatis配置时出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)...

    如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因是Mapper i ...

  2. 总结mybatis plus解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)方法

    总结解决 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)方法 问题背景:在做Spring ...

  3. Mybatis报错:nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘XXX‘ not found

    问题 使用Mybatis过程中报错 nested exception is org.apache.ibatis.binding.BindingException: Parameter 'XXX' no ...

  4. springboot整合Mybatis提示org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

    在用maven配置mybatis环境时出现此BindingExceptiony异常,发现在classes文件下没有mapper配置文件,应该是maven项目没有扫描到mapper包下的xml文件, 在 ...

  5. Mybatis报错org.apache.ibatis.binding.BindingException: Type interface com.trf.dao.UserDao is not known

    报错log:org.apache.ibatis.binding.BindingException: Type interface com.trf.dao.UserDao is not known to ...

  6. mybatis找不到xml中的方法;org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

    mybatis配置mapper对的.配置dao对的.配置都是对的,但是就是发现不了方法,那就是xml找到的问题了,在群友的提示下找到target/classes文件夹里根本没有xml文件.故找到原因: ...

  7. MyBatis报错:org.apache.ibatis.binding.BindingException: Type interface com.smbms.dao.provider.Provider

    在Java使用MyBatis框架开发时,遇到报错:org.apache.ibatis.binding.BindingException: Type interface com.smbms.dao.pr ...

  8. MyBatis中接口代理异常org.apache.ibatis.binding.BindingException: Type * is not known to the MapperRegistry

    异常位置:        sqlSession.getMapper(studentMapper.class);        获得目标接口实现类对象时报错; 解决办法: 1. 映射配置文件中的空间名称 ...

  9. Mybatis报错:org.apache.ibatis.binding.BindingException:has an unsupported return type:

    错误代码 org.apache.ibatis.binding.BindingException: Mapper method 'com.tulun.dao.StudentMapper1.insertS ...

最新文章

  1. jenkins执行xctool命令出现command not found问题解决方法
  2. 杰奇为什么只能用php5.2,杰奇2.2修改系统定义后,网站报错问题解决
  3. php 同步代码,PHP进程同步代码实例
  4. python方向键控制角色_python方向键控制上下左右代码
  5. plt.subplots中的ax = ax.flatten()
  6. 野生前端的数据结构基础练习(8)——图
  7. 基于40万表格数据集TableBank,用MaskRCNN做表格检测
  8. ADS软件仿真实例大战(一)
  9. GBase项目管理实践总结——WBS分解的关键事项
  10. 计算机网络的分类3:按网络的工作方式分类,分为集中式网络、分布式网络
  11. Linux下设置MTU值到9000
  12. 血管有多好,你就能活多久!这几种伤血管行为,你还在做吗?
  13. 如何化解频临离婚边缘的婚姻危机
  14. 红外补光 vs白光补光
  15. PCL点云库可视化常用函数与经验总结
  16. Entity Framework 6三层架构入门:创建数据访问层DAL
  17. linux指法教程,linux系统指法练习与打字游戏软件
  18. 易中天品汉代风云人物05:韩信被杀之谜
  19. 【目标检测--tricks】FPN和PAN
  20. 网络安全实验室—基础关

热门文章

  1. DataBinder.Eval值的判断
  2. PowerDesign连接远程数据库
  3. 万能上传击溃ASP/PHP/JSP脚本系统
  4. 有哪些适合新手练手的前端项目?
  5. Android达摩院的起点
  6. 计算机一次传输多少kb,电脑知识:1M等于多少Kb
  7. android中设置网络加载的转圈圈图标
  8. 因为一个人,厌倦一座城
  9. C#,K-均值(K-Means)聚类算法的核心源代码
  10. 读书笔记——《富爸爸穷爸爸》