zoukankan      html  css  js  c++  java
  • Spring10种常见异常解决方法

    一、找不到配置文件的异常

    解释:这个的意思是说,没有找配置文件为controller的xml,修改一下配置文件名字即可。

    二、在xml中配置的命名空间找不到对应的Schema的异常

    xmlns:util="http://www.springframework.org/schema/util" 去掉,因为schema中不存在util命名

    三、找不到jackson.jar的异常

    缺少jackson的jar包,导入jackson-all-1.9.5.jar即可

    四、bean不是唯一的异常

    这个异常是说,一个类配置了多个bean之后,我们还在使用ctx.getBean(Person.class);方法,即根据bean的类映射去获取bean对象。这个时候返回的bean对象不是唯一的,有多个bean对象。解决方法,就是根据bean的id去获取bean对象。

    五、缺少日志jar包

    这个问题是说,项目中缺少spring依赖的jar包文件。解决方案:加入commons-logging-1.1.3.jar即可。

    六、找不到bean异常

    这个问题是说,项目中找不到name为filter2的bean。说白了就是在applicationContext.xml中找不到id为filter2的bean,配置一下即可。

    七、缺少spring-webmvc-4.0.6.RELEASE.jar包

    解决方案:在项目中加入spring的mvc架包即可。如我的spring版本为4.0.6的,那么就把spring-webmvc-4.0.6.RELEASE.jar添加进去即可。

    八、缺少spring-aop-4.0.6.RELEASE.jar包

    解决方案:在项目中加入spring的aop架包即可。如我的spring版本为4.0.6的,那么就把spring-aop-4.0.6.RELEASE.jar添加进去即可。

    九、缺少spring-expression-4.0.6.RELEASE.jar包

    解决方案:在项目中加入spring的expression架包即可。如我的spring版本为4.0.6的,那么就把spring-expression-4.0.6.RELEASE.jar添加进去即可。

    十、bean的名字name或者id或者别名alias已经存在

    解决方法:把重复的名字改个名字即可。

    十一、bean的自动加载找不到相对应的bean问题

    解决方法:在配置文件中的<beans>根节点下加default-autowire="byName" default-lazy-init="true"或者<context:component-scan base-package="com.xxx.dao.*"></context:component-scan>包下面用*匹配

  • 相关阅读:
    Shared Memory in Windows NT
    Layered Memory Management in Win32
    软件项目管理的75条建议
    Load pdbs when you need it
    Stray pointer 野指针
    About the Rebase and Bind operation in the production of software
    About "Serious Error: No RTTI Data"
    Realizing 4 GB of Address Space[MSDN]
    [bbk4397] 第1集 第一章 AMS介绍
    [bbk3204] 第67集 Chapter 17Monitoring and Detecting Lock Contention(00)
  • 原文地址:https://www.cnblogs.com/xinxin1994/p/5105383.html
Copyright © 2011-2022 走看看