springboot项目启动后,用浏览器访问项目后的异常处理:
ERROR 3912 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/springboot03] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.UnsupportedOperationException
### The error may exist in file [E:\TestJavaSE\Test\springboot_all\springboot03\target\classes\mybatis\userMapper.xml]
### The error may involve com.msb.mapper.UserMapper.findAllUser
### The error occurred while handling results
### SQL: select * from user;
### Cause: java.lang.UnsupportedOperationException] with root cause

原因分析:
mapper.xml映射文件内的
resultType="list">写错
错误纠正:
将resultType="list">改为resultType="user">后重新运行项目后正常访问

本文介绍了在SpringBoot项目中遇到的一个异常情况,当尝试通过浏览器访问项目时,出现了一个关于MyBatis的UnsupportedOperationException。错误源于mapper.xml文件中的resultType配置错误,原本设置为'list',正确做法应改为'user'。修复这个错误后,项目成功启动并能正常访问。

被折叠的 条评论
为什么被折叠?



