下面是我这几天整合SpringMVC+Spring+MyBatis框架遇到的一些问题 ,在这里总结一下:
1:HTTP Status 500 - Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
问题是:数据库连接出错,一般是配置数据库连接的url、username、password或者是数据库连接失败
url配置:jdbc:mysql://数据库地址:端口号/数据库名?编码等 //如:url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8
2:HTTP Status 500 - Servlet.init() for servlet SpringMVC threw exception
....(此处省略上上重点错误,如下:)
root cause
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userController‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.service.UserService com.controller.UserController.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.service.UserService] 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)}
问题是:业务层没有@Service注解
提示大概的意思是controller里的的UserService自动注入失败
3:[spring]启动时报错:NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I
Spring V4.1.0+的版本在不支持Servlet3.0的应用服务器上跑时会报以下错误:
NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I
比如说:tomcat 7以下的版本、jboss 4.2.3以下的版本
解决版本有两个(任意选一个即可):
1)、退回到Spring V4.0.7
2)、升级应用服务器到支持Servlet3的应用服务器。
比如tomcat7+(最好是tomcat8+)、jboss as 7+
IDEA搭建SSM出现的一些错误
原文:https://www.cnblogs.com/EmilZs/p/9595393.html