SSM时遇到的异常(10)——...Cause: ...ClassCastException: java.lang.String cannot be cast

论坛 期权论坛 脚本     
匿名技术用户   2020-12-28 17:21   11   0

JDK1.7+Tomcat7.0+Eclipse+SSM+Bootstrap(含Bootstrap Table)

三月 07, 2019 8:56:18 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [SpringMVC] in context with path [/HTGlory] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
### The error may exist in file [F:\ALL_Course\10Activiti\Ecli\.metadata\.plugins\org.eclipse.wst.server.core\tmp4\wtpwebapps\HTGlory\WEB-INF\classes\com\ht\lym\mapper\StudentJobsDao.xml]
### The error may involve com.ht.lym.mapper.StudentJobsDao.lists-Inline
### The error occurred while setting parameters
### SQL: select j.*,s.studName,c.className from studentjobs j inner join student s on j.studId=s.studId     left join cls c on j.classId=c.classId where studName like concat('%',?,'%') limit ?,?;
### Cause: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer] with root cause
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
 at org.apache.ibatis.type.IntegerTypeHandler.setNonNullParameter(IntegerTypeHandler.java:26)
 at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:50) 

异常里讲的提示得很明显了:

发现,还真是有错误!!!

上图(StudentJobsDao.java)和 下图(StudentJobsDao.xml)

改:

补充:

为什么会出现cannot be cast to java.lang.String(另外问题的解决方案)

推荐:[也是parameterType属性错误使用导致的问题]

IllegalStateException: Optional int parameter 'id' is present but cannot be translate

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP