您的位置:首页 > 其它

Maven+SSM框架下项目开发常见异常及解决方案(二)

2017-08-03 17:18 405 查看
1.

Servlet.service() for servlet [SpringMVC] in context with path [/biglovewj] threw exception [Request processing failed; nested exception  is org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map com.biglovewj.dto.Daily] with root cause java.lang.IllegalArgumentException: Parameter Maps collection does not contain value for com.biglovewj.dto.User


原因: mybatis的mapper文件中,XXXMapper.xml 文件中 增、改等方法参数类型存在错误。

解决方法: 参数类型为 parameterType 而非 parameterMap

2.

Servlet.service() for servlet [SpringMVC] in context with path [/biglovewj] threw exception [Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'diningController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.biglovewj.service.impl.DiningService com.biglovewj.controller.DiningController.service; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.biglovewj.service.impl.DiningService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}] with root cause
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.biglovewj.service.impl.DiningService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}


原因:在controller层中,autowired注解下的service层为该层的接口类而非实现类

解决方法:查找错误的自动装配类型,将实现类改为接口类

3.

Servlet.service() for servlet jsp threw exception
javax.el.PropertyNotFoundException: Property 'col_linkName' not found on type com.biglovewj.dto.Collectivity


原因: jsp 页面中尝试获取了请求作用域中对象未包含的属性

解决方法: 找到报错的对象的正确属性,并修改jsp中的错误属性

4.

Servlet.service() for servlet [SpringMVC] in context with path [/biglovewj] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorE
a4bf
xception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'XXX'' at line


原因: sql语言格式错误(注意如果基本格式没有错误的话,那就看看标点是不是用错了,尤其看最后一个字段值设置完毕后是不是多加了一个逗号)

解决方法: 修改错误的sql语句

5.提交表单信息时报错

type Status report description The request sent by the client was syntactically incorrect.


原因: 提交的表单中的字段可能存在问题,eg:某个字段的数据库类型是int 但是提交的字段中却包含字母、特殊符号等

解决方法: 检查表单中所有字段类型是否对应model层实体类的属性类型
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: