报错org.apache.ibatis.binding.BindingException: Type interface com.atguigu.mybatis.bean.dao.EmployeeMapper is not known to the MapperRegistry.

我报这个错误的原因是因为mybatis-config.xml配置文件中

<!-- 批量注册: -->
<package name="com.atguigu.mybatis.dao"/>

没有写对,根据路径改正就可以了。比如说应该写成

<package name="com.atguigu.mybatis.dao"/>

结果我写成了

<package name="com.atguigu.mybatis.bean.dao"/>

报错完整信息如下所示:

org.apache.ibatis.binding.BindingException: Type interface com.atguigu.mybatis.bean.dao.EmployeeMapper is not known to the MapperRegistry.
at org.apache.ibatis.binding.MapperRegistry.getMapper(MapperRegistry.java:47)
at org.apache.ibatis.session.Configuration.getMapper(Configuration.java:717)
at org.apache.ibatis.session.defaults.DefaultSqlSession.getMapper(DefaultSqlSession.java:292)
at com.atguigu.mybatis.test.MyBatisTest.test01(MyBatisTest.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

原文地址:https://www.cnblogs.com/liaoxiaolao/p/9973310.html

时间: 2024-07-30 16:47:18

报错org.apache.ibatis.binding.BindingException: Type interface com.atguigu.mybatis.bean.dao.EmployeeMapper is not known to the MapperRegistry.的相关文章

【ide】MyBatis报错: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:225) at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48) at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65) at org.a

Maven项目使用mybatis报错 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):

maven项目使用mybatis时,找不到mapper文件(.xml) 错误信息提示: 项目可以正常运行,但是在有请求到达服务器时(有访问数据库的请求),会出现报错!! 错误原因: mybatis没有找到对应的请求调用持久层的方法 查错方法: 首先检查target-->classes文件夹被dao层文件夹内是否有对应mapper.xml文件,如果有xml文件,则一般是配置文件出现的错误,如果没有xml类型的文件,则是没有拷贝资源文件的原因.下面是对应的解决方法. 1.名称不一致问题 排查步骤:

MyBatis笔记----报错:Exception in thread &quot;main&quot; org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解决方法

报错 Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.ij34.model.UserMapper.selectarticle at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:230) at or

【mybatis】mybatis访问报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

mybatis访问报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 需要检查的步骤: 1.是否mapper.java文件上使用了注解@Mapper  或者 在启动类上扫描了Mapper类 @MapperScan("com.swapping.springcloud.ms.integral.mapper")   [注意扫描的包名是否正确] 2.注意mapper.xml文件中的

MyBatis笔记----报错Exception in thread &quot;main&quot; org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.ij34.model.UserMapper.selectUser

信息: Refreshing org[email protected]41cf53f9: startup date [Wed Apr 05 16:48:12 CST 2017]; root of context hierarchy 四月 05, 2017 4:48:12 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息: Loading XML bean definiti

通过maven test 报org.apache.ibatis.binding.BindingException: Invalid bound statement

背景 直接使用eclipse工具去执行,没有问题,通过testng.xml去执行,没有问题,但通过mvn clean test执行,就报错,提示org.apache.ibatis.binding.BindingException: Invalid bound statement 解决方法 首先先肯定的是:mybatis的配置是没有问题,因为eclipse可以正常执行: 在eclipse中把mapper的xml文件放到src代码目录下是可以一起打包进classes的,而maven去编译的时候不会,

IDEA异常解决: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

有时候解决问题不仅仅是解决问题.-----jstarseven 最近因为开发需要,需要搭建一个ssm开发框架,采用了开发工具IDEA. 整合完了SSM开发框架之后,发布的时候出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found... 一开始以为是自己配置文件写的有问题找了半天也没有问题,之后才发现是自己对IDEA工具使用的不够熟悉. 先说该异常常见解决方案: 一般是xml映射文件有错误.但

org.apache.ibatis.binding.BindingException【原因汇总】

背景:Spring整合Mybatis 报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 解释:就是说,你的Mapper接口,被Spring注入后,却无法正常的使用mapper.xml的sql: 这里的Spring注入后的意思是,你的接口已经成功的被扫描到,但是当Spring尝试注入一个代理(MyBatista实现)的实现类后,却无法正常使用.这里的可能发生的情况有如下几种: 接口已

Spring Boot:Caused by: org.apache.ibatis.binding.BindingException: Parameter &#39;deptId&#39; not found.

1. 错误信息描述 在使用Spring Boot + Mybaits从前台向后台提交数据时,控制台报出该错误信息 2. 报错原因 在dao接口中,该方法拥有两个参数,Mybaits无法区分这两个参数 3. 解决方法 在dao方法中为这两个参数分别标注Mybaits的@Param注解,对这两个参数加以区分 List<ManagerSelectResult>selectToday(@Param("deptId") Integer deptId, @Param("off