zoukankan      html  css  js  c++  java
  • MyBatisSystemException->BindingException: Parameter 'xxx' not found. Available parameters are [arg1, arg0, param1, param2]

    最近在使用Spring boot+mybatis做新的基础框架,结果碰到如下问题:


    1
    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'eName' not found. Available parameters are [arg1, arg0, param1, param2] 2 at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) 3 at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) 4 at com.sun.proxy.$Proxy62.selectOne(Unknown Source) 5 at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166) 6 at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:87) 7 at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58) 8 at com.sun.proxy.$Proxy101.getByENameOrCName(Unknown Source) 9 at com.enuo.biz.server.impl.EnuoPermissionTypeServiceImpl.add(EnuoPermissionTypeServiceImpl.java:34) 10 at com.enuo.api.controller.account.company.permission.EnuoPermissionTypeController.add(EnuoPermissionTypeController.java:35) 11 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 12 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 13 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 14 at java.lang.reflect.Method.invoke(Method.java:498) 15 at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) 16 at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) 17 at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) 18 at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) 19 at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) 20 at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) 21 at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) 22 at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) 23 at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) 24 at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908) 25 at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) 26 at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) 27 at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) 28 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) 29 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 30 at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) 31 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 32 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 33 at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) 34 at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) 35 at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) 36 at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) 37 at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387) 38 at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) 39 at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) 40 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 41 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 42 at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) 43 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 44 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 45 at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) 46 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 47 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 48 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 49 at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) 50 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 51 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 52 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 53 at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) 54 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 55 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 56 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 57 at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) 58 at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 59 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 60 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 61 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) 62 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) 63 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) 64 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) 65 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) 66 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) 67 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) 68 at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) 69 at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) 70 at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) 71 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) 72 at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) 73 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 74 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 75 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 76 at java.lang.Thread.run(Thread.java:748) 77 Caused by: org.apache.ibatis.binding.BindingException: Parameter 'eName' not found. Available parameters are [arg1, arg0, param1, param2] 78 at org.apache.ibatis.binding.MapperMethod$ParamMap.get(MapperMethod.java:212) 79 at org.apache.ibatis.reflection.wrapper.MapWrapper.get(MapWrapper.java:45) 80 at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122) 81 at org.apache.ibatis.executor.BaseExecutor.createCacheKey(BaseExecutor.java:219) 82 at org.apache.ibatis.executor.CachingExecutor.createCacheKey(CachingExecutor.java:146) 83 at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:84) 84 at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) 85 at com.sun.proxy.$Proxy128.query(Unknown Source) 86 at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147) 87 at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140) 88 at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76) 89 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 90 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 91 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 92 at java.lang.reflect.Method.invoke(Method.java:498) 93 at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) 94 ... 73 more

     而这个报错运用到的代码是在查询语句中,我的Mapper代码传递了两个参数, 而当我们只有一个参数的使用,Mapper.xml文件中只要写上一个#{xx}就可以了,前面就好奇如果两个会怎么样,结果发现报了如上的错误, 而当传递多个参数的时候, 则需要再Mapper代码的参数前面加上@Param("xx")来做定义.

  • 相关阅读:
    打开安装 好的Microsoft Dynamics CRM 4.0 报错误为 Caller does not have enough privilege to set CallerOriginToken to the specified value 的解决办法
    基于 Windows Server 2008 的计算机对 Microsoft Dynamics CRM 4.0 的支持
    Microsoft Dynamics CRM 4.0 如何添加自定义按钮
    Microsoft Dynamics CRM 4.0 Plugin 取值,赋值,查询
    C# 中的 enum(枚举) 类型使用例子
    vue事件的绑定
    表单验证2
    node中模块
    node模块的引入
    node中的读文件
  • 原文地址:https://www.cnblogs.com/Grace-is-enough/p/10756853.html
Copyright © 2011-2022 走看看