org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): me.tspace.pm.dao.UserDao.getUser
at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:178)
at org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:38)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42)
at $Proxy22.getUser(Unknown Source)
........................
........................
Caused by: java.lang.IllegalArgumentException: Mapped Statements
collection does not contain value for me.tspace.pm.dao.UserDao.getUser
at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:775)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:615)
at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:608)
at org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:176)
... 34 more
两种情况:
1.
mapper的namespace写的不对!!!注意系修改。
2.
UserDao的方法在UserDao.xml中没有,然后执行UserDao的方法会报此错。
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'org.mybatis.spring.mapper.MapperScannerConfigurer#0' defined in class
path resource [springMVC.xml]: Cannot resolve reference to bean
'sqlSessionFactory' while
setting bean property 'sqlSessionFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'sqlSessionFactory' defined in class path resource
[springMVC.xml]: Invocation of init method failed; nested
exception is org.springframework.core.NestedIOException: Failed to
parse config resource: class path resource [mybatisConfig.xml]; nested
exception is org.apache.ibatis.builder.BuilderException: Error parsing
SQL Mapper Configuration. Cause: java.lang.RuntimeException:
Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException:
Mapped Statements collection already contains value for
me.tspace.pm.dao.UserDao.getUser
mybatis的貌似mapper不允许重载.......
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException: The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,plugins?,environments?,databaseIdProvider?,mappers?)".
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:79)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:63)
at man.send.TestPushEmail.testMybatis(TestPushEmail.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
节点顺序需要按照提示放置!
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
org.apache.ibatis.binding.BindingException: Type interface main.send.dao.SearchRecordDao is not known to the MapperRegistry.
at org.apache.ibatis.binding.MapperRegistry.getMapper(MapperRegistry.java:42)
at org.apache.ibatis.session.Configuration.getMapper(Configuration.java:639)
at org.apache.ibatis.session.defaults.DefaultSqlSession.getMapper(DefaultSqlSession.java:218)
at main.send.service.impl.SearchRecordServiceImpl.getRandomId(SearchRecordServiceImpl.java:17)
at man.send.TestPushEmail.SearchRecordService(TestPushEmail.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
网友评论