Tomcat访问页面出现500错误,并给出以下错误信息

Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=‘password’, mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId=‘null’, jdbcTypeName=‘null’, expression=‘null’}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #3 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2).

错误原因的再mybatis中的SQL语句写错了,参数并没有正确赋值,导致参数索引产生异常。

解决办法:
检查SQL语句的格式与变量值,是否与所给赋的属性值相同。最需要注意的就是#{属性名},这里的#与花括号之间千万不能有空格,千万不能!!!

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐