MyBatis的常见异常
- 1. java.lang.IllegalArgumentException: At least one base package must be specified
问题:配置文件中的扫描器路径错误;
解决:修改路径
- 2. Caused by: java.sql.SQLException: No database selected
问题:没有选择数据库
解决:查看jdbc文件中url = jdbc:mysql://localhost:3306/数据库名 是否正确
-3. org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): org.aptech.hdax.Dao.OrderDao.getall
问题:mybatis中dao接口与mapper配置文件在做映射绑定的时候出现问题
解决:在mapper配置文件查看id对应的dao接口是否正确
-4. org apache. ibatis. binding. BindingException: Type interface org . aptech. hdax . dao. BlonDao is not known to the MapperRegistry.
问题:mybatis配置中没有导入mapper配置文件
解决:mybatis配置文件中填入mapper映射文件路径