报错信息:
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.web.mybatis.mapper.ArticleMapper.selectArticelByOrderId ### The error may exist in com/web/mybatis/mapper/OrderMapper.xml ### The error may involve com.web.mybatis.mapper.OrderMapper.selectOrderById ### The error occurred while handling results ### SQL: SELECT u.*,o.id AS oid,code,total,user_id FROM tb_user3 u,tb_order o WHERE u.id=o.user_id AND o.id=? ### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.web.mybatis.mapper.ArticleMapper.selectArticelByOrderId at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:84) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58) at com.sun.proxy.$Proxy0.selectOrderById(Unknown Source) at com.web.mybatis.test.ManyToManyTest.testSelectOrderById(ManyToManyTest.java:29) at com.web.mybatis.test.ManyToManyTest.main(ManyToManyTest.java:40) Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.web.mybatis.mapper.ArticleMapper.selectArticelByOrderId at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:933) at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:726) at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:719) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getNestedQueryMappingValue(DefaultResultSetHandler.java:740) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getPropertyMappingValue(DefaultResultSetHandler.java:465) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyPropertyMappings(DefaultResultSetHandler.java:441) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:902) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForNestedResultMap(DefaultResultSetHandler.java:867) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:326) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:301) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:194) at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65) at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ... 7 more
原因:在MyBatis配置文件mybatis-config.xml中,引入mapper文件路径出错