zoukankan      html  css  js  c++  java
  • 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:UsersAdministrator.SC-201810221720.m2 epositorymysqlmysql-connector-java5.1.27mysql-connector-java-5.1.27.jar} -> [Help 1]
      大致意思应该是mysql驱动包连接不到。
      这里就是generatorConfig.xml文件中的classPathEntry路径配置错误,这里范了个很低级的错误,最后那里多了个方括号(“}”)

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


  • 相关阅读:
    Ural 1057. Amount of Degrees
    BZOJ 3517: 翻硬币
    BZOJ 4527: K-D-Sequence
    CTC联结时间分类算法(语音、文本识别)
    我小苏太狼又回来了.
    /*--------------分割线--------------*/
    /*--------------分割线--------------*/
    洛谷 P4149 [IOI2011]Race-树分治(点分治,不容斥版)+读入挂-树上求一条路径,权值和等于 K,且边的数量最小
    Codeforces 161.D. Distance in Tree-树分治(点分治,不容斥版)-树上距离为K的点对数量-蜜汁TLE (VK Cup 2012 Round 1)
    洛谷 P2634 [国家集训队]聪聪可可-树分治(点分治,容斥版) +读入挂+手动O2优化吸点氧才过。。。-树上路径为3的倍数的路径数量
  • 原文地址:https://www.cnblogs.com/EmilZs/p/9595393.html
Copyright © 2011-2022 走看看