初学mybatis时出现 org.apache.ibatis.binding.BindingException报错
错误分析:由于每一个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报错相关推荐
- mybatis配置时出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)...
如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因是Mapper i ...
- 总结mybatis plus解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)方法
总结解决 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)方法 问题背景:在做Spring ...
- 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 ...
- springboot整合Mybatis提示org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
在用maven配置mybatis环境时出现此BindingExceptiony异常,发现在classes文件下没有mapper配置文件,应该是maven项目没有扫描到mapper包下的xml文件, 在 ...
- 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 ...
- mybatis找不到xml中的方法;org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
mybatis配置mapper对的.配置dao对的.配置都是对的,但是就是发现不了方法,那就是xml找到的问题了,在群友的提示下找到target/classes文件夹里根本没有xml文件.故找到原因: ...
- 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 ...
- MyBatis中接口代理异常org.apache.ibatis.binding.BindingException: Type * is not known to the MapperRegistry
异常位置: sqlSession.getMapper(studentMapper.class); 获得目标接口实现类对象时报错; 解决办法: 1. 映射配置文件中的空间名称 ...
- Mybatis报错:org.apache.ibatis.binding.BindingException:has an unsupported return type:
错误代码 org.apache.ibatis.binding.BindingException: Mapper method 'com.tulun.dao.StudentMapper1.insertS ...
最新文章
- jenkins执行xctool命令出现command not found问题解决方法
- 杰奇为什么只能用php5.2,杰奇2.2修改系统定义后,网站报错问题解决
- php 同步代码,PHP进程同步代码实例
- python方向键控制角色_python方向键控制上下左右代码
- plt.subplots中的ax = ax.flatten()
- 野生前端的数据结构基础练习(8)——图
- 基于40万表格数据集TableBank,用MaskRCNN做表格检测
- ADS软件仿真实例大战(一)
- GBase项目管理实践总结——WBS分解的关键事项
- 计算机网络的分类3:按网络的工作方式分类,分为集中式网络、分布式网络
- Linux下设置MTU值到9000
- 血管有多好,你就能活多久!这几种伤血管行为,你还在做吗?
- 如何化解频临离婚边缘的婚姻危机
- 红外补光 vs白光补光
- PCL点云库可视化常用函数与经验总结
- Entity Framework 6三层架构入门:创建数据访问层DAL
- linux指法教程,linux系统指法练习与打字游戏软件
- 易中天品汉代风云人物05:韩信被杀之谜
- 【目标检测--tricks】FPN和PAN
- 网络安全实验室—基础关