当前位置:首页 > Java技术 > Expected one result (or null) to be returned by selectOne(), but found: 2

Expected one result (or null) to be returned by selectOne(), but found: 2

2022年11月07日 21:05:16Java技术6
  • 异常信息
Expected one result (or null) to be returned by selectOne(), but found: 2 _ JavaClub全栈架构师技术笔记 Expected one result (or null) to be returned by selectOne(), but found: 2 _ JavaClub全栈架构师技术笔记
04-Aug-2019 14:32:50.093 严重 [http-apr-8080-exec-6] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2] with root cause
 org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:70)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)
    at com.sun.proxy.$Proxy23.selectOne(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
    at com.sun.proxy.$Proxy28.selectUserByPhone(Unknown Source)
    at com.aone.app.service.impl.UserServiceImpl.login(UserServiceImpl.java:99)
    at com.aone.app.service.impl.UserServiceImpl$$FastClassBySpringCGLIB$$4dfb8fbe.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
    at com.aone.app.service.impl.UserServiceImpl$$EnhancerBySpringCGLIB$$4509de54.login(<generated>)
    at com.aone.app.controller.LoginUserController.login(LoginUserController.java:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at com.aone.app.filter.SimpleCORSFilter.doFilter(SimpleCORSFilter.java:40)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)

04-Aug-2019 14:33:01.981 信息 [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Destroying Spring FrameworkServlet 'springmvc'
04-Aug-2019 14:33:01.987 信息 [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
View Code
  • 问题来源
其意思为查询的结果应该是一条,但实际查询的结果是多条或是空的

这时应该去看下数据库里面的记录是不是只有一条记录

转载于:https://www.cnblogs.com/LJing21/p/11298174.html

作者:weixin_30668887
来源链接:https://blog.csdn.net/weixin_30668887/article/details/102278419

版权声明:
1、JavaClub(https://www.javaclub.cn)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。

2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。


本文链接:https://www.javaclub.cn/java/68413.html

标签: Exception
分享给朋友:

“Expected one result (or null) to be returned by selectOne(), but found: 2” 的相关文章

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

package cn.itcast.day1; //import static java.lang.Math.max; //import static java.lang.Math.*; public class StaticImport { public sta...

Uncaught Error: SECURITY_ERR: DOM Exception 18

Question: I get the following error in Ch...

Error和Exception、异常处理机制、自定义异常及经验小结

Error和Exception、异常处理机制、自定义异常及经验小结

什么是异常 实际工作中,遇到的情况不可能是非常完美的。比如:你写的某个板块,用户输入不一定符合你的要求、你的程序要打开某一个文件,这个文件可能不存在或者文件格式不对,你要读取数据库的数据,数据库可能是空的等。我们的程序在跑着,内存或硬盘可能满了。等等 软件...

Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExce

Error setting property values ; nested exception is org.springframework.beans.NotWritablePropertyException <!-- 添加一个dao类&...

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘externalDump

  在学习SpringCloud Alibaba Nacos时,出现了上述异常,因为我的数据库是8.0+版本,所以得在nacos的application.properties文件中db.url.0那一行加上参数useJDBCCompliantTimezoneShift=tru...

android java.lang.RuntimeException: Stub!错误

Exception in thread "main" java.lang.RuntimeException: Stub! at android.util.Base64.encodeToString(Base64.java:8) at pos.tre.c...

异常处理之[Error: com.android.ide.common.process.ProcessException]

异常处理之[Error: com.android.ide.common.process.ProcessException]

昨天开发过程中,build时出现异常,错误消息如下: Error:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException: Er...

Android开发问题记录-ARouter init logistics center exception

在Bugly中发现存在偶现的崩溃问题如下: #5404 com.alibaba.android.arouter.exception.HandlerException 更详细的信息如下: java.lang.RuntimeExcept...

`org.springframework.beans.factory.UnsatisfiedDependencyException异常处理

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'moneyNotifyController': Unsatisfied dependency...

mybatis异常:nested exception is org.apache.ibatis.builder.BuilderException: Error resolving JdbcType

mybatis异常:nested exception is org.apache.ibatis.builder.BuilderException: Error resolving JdbcType

异常详细 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Ca...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。