今天完成的事情:今天就写了一个ssm项目,写完跑的时候各种报错,有的是因为自己不了解的知识点,但更多的还是因为不细心,好多不应该出错的地方都报错.
明天计划完成的事情:现在打算明天把这个项目完整的跑通,然后再自己复盘一下,然后把任务二深度思考和其他需要理解的知识点学习一下,在15号之前进入任务三.
遇到的问题:
1.Handler processing failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
翻译:处理程序处理失败; 嵌套异常是java.lang.NoClassDefFoundError:javax / servlet / jsp / jstl / core / Config
原因:jstl jar包的原因,换成1.2版本的就好了
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
2.空指针:
1.看是否创建对象时被设置成了null
2.每个到都要@autowird

3.org.springframework.web.util.NestedServletException: 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='info_user', 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 #1 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 (1 > number of parameters, which is 0)
翻译:org.springframework.web.util.NestedServletException:请求处理失败; 嵌套异常是org.mybatis.spring.MyBatisSystemException:嵌套异常是org.apache.ibatis.type.TypeException:无法设置映射参数:ParameterMapping {property ='info_user',mode = IN,javaType = class java.lang。 String,jdbcType = null,numericScale = null,resultMapId ='null',jdbcTypeName ='null',expression ='null'}。原因:org.apache.ibatis.type.TypeException:使用JdbcType null为参数#1设置非空值时出错。尝试为此参数或不同的配置属性设置不同的JdbcType。原因:java.sql.SQLException:参数索引超出范围(1>参数数,为0)
原因:最后发现原来是自己mapper里的sql语句括号写错了
4.
4.Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'info_user' not found. Available parameters are [0, 1, param1, param2]
翻译:请求处理失败; 嵌套异常是org.mybatis.spring.MyBatisSystemException:嵌套异常是org.apache.ibatis.binding.BindingException:未找到参数'info_user'。可用的参数是[0,1,param1,param2]
解决办法:
当只传一个参数到sql语句时,可以直接写参数名,当传多个参数时,应当这样写(多个参数已#{0}开始):
或者还有一种解决办法,在dao层方法参数上加@Param


5.Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.mycom.myapp.dao.StudentDAO.selectStudentByID
翻译: 嵌套异常是org.apache.ibatis.binding.BindingException:无效的绑定语句(未找到):com.mycom.myapp.dao.StudentDAO.selectStudentByID
无非就是dao层方法写错了或者mapper写错了,细心解决80%的bug
收获:虽然问题很多,但是还是有收获的,感觉自己解决问题有了点套路,不像以前茫然无措了.
评论