浏览器访问项目资源时,报HTTP Status 500 – Internal Server Error

使用浏览器访问项目时,出现异常:Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'cn.itcast.dao.AccountDao.findAll'. It's likely that neither a Result Type nor a Result Map was specified.

浏览器报错:

Type 异常报告

消息 Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'cn.itcast.dao.AccountDao.findAll'. It's likely that neither a Result Type nor a Result Map was specified.


描述 服务器遇到一个意外的情况,阻止它完成请求。

Exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'cn.itcast.dao.AccountDao.findAll'. It's likely that neither a Result Type nor a Result Map was specified. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:986) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:870) javax.servlet.http.HttpServlet.service(HttpServlet.java:634) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:855) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) Root Cause org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'cn.itcast.dao.AccountDao.findAll'. It's likely that neither a Result Type nor a Result Map was specified. org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:79) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447) com.sun.proxy.$Proxy39.selectList(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:231) org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137) org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) com.sun.proxy.$Proxy40.findAll(Unknown Source) cn.itcast.service.impl.AccountServiceImpl.findAll(AccountServiceImpl.java:20) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   ...

Root Cause

org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'cn.itcast.dao.AccountDao.findAll'.  It's likely that neither a Result Type nor a Result Map was specified.
	org.apache.ibatis.executor.resultset.DefaultResultSetHandler.validateResultMapsCount(DefaultResultSetHandler.java:287)
	org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:189)
	org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
	org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
	org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
	org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
     ...

浏览器报此异常是因为使用mybatis访问数据库时对结果集进行封装出现异常,也就是说 mybatis 的mapper配置文件中对执行语句结果集的封装出现了问题。

需要查看mapper配置文件中执行语句的结果集,对其进行修改即可。

 

上一篇:MyBatisUtil、 MyBatis分页拦截器


下一篇:日志工厂