Springboot-001-解决nested exception is org.apache.ibatis.binding.BindingException: Parameter 'env' not found. Available parameters are [arg1, arg0, param1, param2]
环境:Springboot + Mybatis + MySQL + VUE
场景:
前端发出数据比对请求,在服务后台与数据库交互时,接口提示错误信息如下所示:
{
"code": 999,
"success": false,
"msg": "nested exception is org.apache.ibatis.binding.BindingException: Parameter 'env' not found. Available parameters are [arg1, arg0, param1, param2]",
"menu": "DATABASE",
"action": "DATABASE_COMPARE",
"operator": "ANON",
"datetime": "2018-10-23 11:26:17.877"
}
控制台日志响应如下所示:

解决:
由错误信息可知,Mybatis在操作数据库前未接收到请求参数,实际为Respository/Mapper中的SQL语句中引用的参数未获取到所导致的报错信息。查看源码可知,如下代码中蓝色加粗部分缺失导致的,添加后,问题解决。
@Select("select * from `data` " +
"where eng = #{eng} and env like '%${env}%' ")
@Results({
@Result(property = "id", column = "id"),
@Result(property = "env", column = "env"),
@Result(property = "eng", column = "eng"),
})
List<Database> findAllComp(@Param("eng") String eng, @Param("env") String env);
Springboot-001-解决nested exception is org.apache.ibatis.binding.BindingException: Parameter 'env' not found. Available parameters are [arg1, arg0, param1, param2]的更多相关文章
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'userId' not found. Available parameters are [arg1, arg0, param1, param2]
2018-06-27 16:43:45.552 INFO 16932 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : ...
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [1, 0, param1, param2]
Spring+mybatis错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.bi ...
- SpringBoot整合Mybatis注解版---update出现org.apache.ibatis.binding.BindingException: Parameter 'XXX' not found. Available parameters are [arg1, arg0, param1, param2]
SpringBoot整合Mybatis注解版---update时出现的问题 问题描述: 1.sql建表语句 DROP TABLE IF EXISTS `department`; CREATE TABL ...
- ### Cause: org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [arg1, arg0, param1, param2]
org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: org.apache.ib ...
- org.apache.ibatis.binding.BindingException: Parameter '0' not found. Available parameters are [arg1, arg0, param1, param2]
报错信息如下: org.apache.ibatis.binding.BindingException: Parameter '0' not found. Available parameters ar ...
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'employeeId' not found. Available parameters are [page, map, param1, param2] 解决方法
原因很简单就是没映射到接口添加 @Param 注解 ->@Param("map") 然后在mapper.xml map.employeeId 再次测试 已经解决 ->
- Mybatis报错 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'parentCode' not found. Available parameters are [0, 1, param1, param2]
orcal数据库使用mybatis接收参数,如果传的是多个参数,需要使用#{0},#{1},...等代替具体参数名,0 代表第一个参数,1 代表第二个参数,以此类推. 错误语句: <select ...
- org.apache.ibatis.binding.BindingException: Parameter 'xxx' not found. Available parameters are [arg1, arg0, param1, param2]
这个异常说明参数没有加上@Param注解,加上这个注解就行了. 默认情况下mybatis把参数按顺序转化为[0, 1, param1, param2],也就是说#{0} 和 #{param1} 是一样 ...
- 怪事年年有,今天特别多!org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'empno' not found. Available parameters are [emp, deptno, param1, param
错误: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.Binding ...
随机推荐
- python excel的操作
1.在测试用例中生成的数据报错到已存在的excel里面 1 import xlrd 2 from xlutils.copy import copy 3 class test: 4 def write_ ...
- Quartz+TopShelf实现定时任务
转自 https://www.cnblogs.com/frozenzhang/archive/2016/04/29/5443778.html 1.创建控制台程序 2.添加引用 添加TopShelf的引 ...
- C# 微信开发-----微信会员卡(三)激活会员卡
在会员领取了会员卡之后需要做 一个跳转性激活,模式请看下图: 在创建会员卡的时候需要配置下这个参数的值: memberActivate.aspx页面代码如下: <%@ Page Language ...
- numpy数据去重
import numpy as npx = np.array([1,2,3,2,4,2,5,7,7])print(np.unique(x)) 简单散点图的绘制,没有显示出文字是因为需要下载个插件
- MySql在Mac上的安装与配置详解
Mac下安装mysql5.7 完整步骤(图文详解) 转载---原文地址:https://www.jb51.net/article/103841.htm 本篇文章主要介绍了Mac下安装mysql5.7 ...
- Knockout案例: 全选
- Android读写properties配置文件
写这篇文章之前可以成功运行,文章后就各种找不到文件.所以并没有采用此种方式,后期完善.详见下篇解决方案. 配置文件读取很容易,修改需要注意权限,比如assets目录下就不允许修改. 配置文件的创建: ...
- Python运算符——复合运算符
就相当于算数运算符的后面加一个“=” 例:+= num = num+5 可以写成 num += 5 就是说,等式右边含有左边的变量名,就可以直接去掉,然后右边的符号移到左边去 同样的“-= / ...
- Android开发-Android Studio问题以及解决记录
[Android开发] Android Studio问题以及解决记录 http://blog.csdn.net/niubitianping/article/details/51400721 1.真 ...
- url传参过程中文字需编码、解码使用
1.链接进行编码跳转:window.location.href = encodeURI(url) 2.获取当前链接进行解码:decodeURI(window.location); 3.获取url中参数 ...