IDEA搭建SSM出现的一些错误

下面是我这几天整合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+

 
4:java.lang.NoClassDefFoundError: org/springframework/core/MethodIntrospector$MetadataLookup
1)、我这里出现的问题好像是spring-core和其它包发生冲突了,我删了spring-core包后重启IDEA就可以了。
 
 
 
5:在使用Mbatis逆向工程的时间,运行时报:Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate (default-cli) on project shop: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate failed: Cannot resolve classpath entry: C:\Users\Administrator.SC-201810221720\.m2\repository\mysql\mysql-connector-java\5.1.27\mysql-connector-java-5.1.27.jar} -> [Help 1]
  大致意思应该是mysql驱动包连接不到。
  这里就是generatorConfig.xml文件中的classPathEntry路径配置错误,这里范了个很低级的错误,最后那里多了个方括号(“}”)

 

这个路径配置,通过下图直接copy path就ok了

 


 

转载于:https://www.cnblogs.com/EmilZs/p/9595393.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值