一、找不到配置文件的异常
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [com/herman/ss/controller]; nested exception is java.io.FileNotFoundException: class path resource [com/herman/ss/controller] cannot be opened because it does not exist解释:这个的意思是说,没有找配置文件为controller的xml,修改一下配置文件名字即可。
 
<init-param> 
<param-name>contextConfigLocation</param-name> 
<param-value>classpath:com/herman/ss/config/testAjax.xml</param-value>
</init-param>
 
二、在xml中配置的命名空间找不到对应的Schema的异常nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'util:list'.xmlns:util="http://www.springframework.org/schema/util" 去掉,因为schema中不存在util命名
 
三、找不到jackson.jar的异常StandardWrapper.Throwable
java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonProcessingException
缺少jackson的jar包,导入jackson-all-1.9.5.jar即可

四、bean不是唯一的异常
org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.herman.ss.pojo.Person] is defined: expected single matching bean but found 7: person0,person1,person2,person3,person4,person5,person6 at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:313) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:985) at com.herman.ss.test.Test0.test1(Test0.java:35) at com.herman.ss.test.Test0.main(Test0.java:111)这个异常是说,一个类配置了多个bean之后,我们还在使用ctx.getBean(Person.class);方法,即根据bean的类映射去获取bean对象。这个时候返回的bean对象不是唯一的,有多个bean对象。解决方法,就是根据bean的id去获取bean对象。
 
五、缺少日志jar包
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactoryCaused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory这个问题是说,项目中缺少spring依赖的jar包文件。解决方案:加入commons-logging-1.1.3.jar即可。

六、找不到bean异常
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'filter2' is defined这个问题是说,项目中找不到name为filter2的bean。说白了就是在applicationContext.xml中找不到id为filter2的bean,配置一下即可。六、缺少spring-webmvc-4.0.6.RELEASE.jar包
严重: Error loading WebappClassLoader  context: /Struts_Spring_Project  delegate: false  repositories:    /WEB-INF/classes/----------> Parent Classloader:org.apache.catalina.loader.StandardClassLoader@b33d0a org.springframework.web.servlet.DispatcherServletjava.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
解决方案:在项目中加入spring的mvc架包即可。如我的spring版本为4.0.6的,那么就把spring-webmvc-4.0.6.RELEASE.jar添加进去即可。

七、缺少spring-aop-4.0.6.RELEASE.jar包
java.lang.NoClassDefFoundError: org/springframework/aop/TargetSource
java.lang.ClassNotFoundException: org.springframework.aop.TargetSource解决方案:在项目中加入spring的aop架包即可。如我的spring版本为4.0.6的,那么就把spring-aop-4.0.6.RELEASE.jar添加进去即可。
 
八、缺少spring-expression-4.0.6.RELEASE.jar包
java.lang.NoClassDefFoundError: org/springframework/expression/ExpressionParser
java.lang.ClassNotFoundException: org.springframework.expression.ExpressionParser
解决方案:在项目中加入spring的expression架包即可。如我的spring版本为4.0.6的,那么就把spring-expression-4.0.6.RELEASE.jar添加进去即可。

九、bean的名字name或者id或者别名alias已经存在
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Bean name 'a' is already used in this <beans> element
解决方法:把重复的名字改个名字即可。

十、bean的自动加载找不到相对应的bean问题
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.yyc.ym.biz.YycBiz] 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)}解决方法:在配置文件中的<beans>根节点下加default-autowire="byName" default-lazy-init="true"或者<context:component-scan base-package="com.xxx.dao.*"></context:component-scan>包下面用*匹配

spring框架常见的10个问题的更多相关文章

  1. Spring框架学习(10)Spring中如何使用事务?

    内容源自:Spring中如何使用事务? 一.为什么要使用事务? 如果我们一个业务逻辑只执行一次sql,是不需要使用事务的.但如果要执行多条sql语句才能完成一个业务逻辑的话,这个时候就要使用事务了. ...

  2. 10.Spring——框架的AOP

    1.Spring 框架的 AOP 2.Spring 中基于 AOP 的 XML架构 3.Spring 中基于 AOP 的 @AspectJ 1.Spring 框架的 AOP Spring 框架的一个关 ...

  3. 04 Spring:01.Spring框架简介&&02.程序间耦合&&03.Spring的 IOC 和 DI&&08.面向切面编程 AOP&&10.Spring中事务控制

    spring共四天 第一天:spring框架的概述以及spring中基于XML的IOC配置 第二天:spring中基于注解的IOC和ioc的案例 第三天:spring中的aop和基于XML以及注解的A ...

  4. Spring框架系列(10) - Spring AOP实现原理详解之AOP代理的创建

    上文我们介绍了Spring AOP原理解析的切面实现过程(将切面类的所有切面方法根据使用的注解生成对应Advice,并将Advice连同切入点匹配器和切面类等信息一并封装到Advisor).本文在此基 ...

  5. 【10分钟学Spring】:(一)初识Spring框架

    简介 Spring是一个轻量级的企业级的Java开发框架.主要是用来替代原来更加重量级的企业级Java技术,比如EJB(Enterprise JavaBean).Java数据对象(Java Data ...

  6. 10 Spring框架--基于注解和xml的配置的应用案例

    1.项目结构 2.基于xml配置的项目 <1>账户的业务层接口及其实现类 IAccountService.java package lucky.service; import lucky. ...

  7. 10 Spring框架--基于注解的IOC配置

    1.工程环境搭建 2.基于注解的IOC配置 IOC注解的分类 (1)用于创建对象的 他们的作用就和在XML配置文件中编写一个<bean>标签实现的功能是一样的@Component: 作用: ...

  8. 使用 Spring Boot 快速构建 Spring 框架应用--转

    原文地址:https://www.ibm.com/developerworks/cn/java/j-lo-spring-boot/ Spring 框架对于很多 Java 开发人员来说都不陌生.自从 2 ...

  9. [Spring框架]Spring IOC的原理及详解。

    这里感谢 CSDN 的原博客:http://blog.csdn.net/m13666368773/article/details/7802126 看后  受益匪浅,这里再重温一遍Spring IOC ...

随机推荐

  1. jq 页面添加布局

    要求: 1)实现如上图页面布局(10分) 2)实现选择城市所添加的内容追加到你喜欢哪个城市下(10分) 3)实现选择游戏所添加的内容追加到你喜欢哪款游戏下(10分) 4)新增的数据字体颜色设置为粉色( ...

  2. EasySwoole-ElasticSearch-Head启动

  3. CodeReview规范

    目标和原则 提高代码质量,及早发现潜在缺陷,降低修改/弥补缺陷的成本 促进团队内部知识共享,提高团队整体水平 评审过程对于评审人员来说,也是一种思路重构的过程,帮助更多的人理解系统 是一个传递知识的手 ...

  4. Redis安装——windows版

    下载地址   : https://github.com/MicrosoftArchive/redis/releases/tag/win-3.2.100 双击进行安装,然后将安装目录配置到环境变量里,打 ...

  5. ArcGIS提取水系并进行生态敏感性分析

    1.前言 此前已经发表过一篇名为<ENVI提取水系并进行生态敏感性分析>的随笔,这篇是用ArcGIS进行水系提取,与前者的区别是上篇一般是对遥感影像进行处理,准确性较高:这篇是讲在没有遥感 ...

  6. options has an unknown property 'modifyVars'. These properties are valid: 处理方法

    webpack 编译时提示 ValidationError: Invalid options object. Less Loader has been initialized using an opt ...

  7. 从MyIE2平滑升级到Maxthon的完美方案

    经过几个Beta版本的测试MyIE2改名为Maxthon的新版浏览器终于发布了正式版本.喜欢MyIE2的朋友们也可以放心的将你的MyIE2升级为Maxthon了.以下是MyIE2平滑过渡到Mathxo ...

  8. C++设计模式 - 状态模式(State)

    状态变化模式 在组件构建过程中,某些对象的状态经常面临变化,如何对这些变化进行有效的管理?同时又维持高层模块的稳定?"状态变化"模式为这一问题提供了一种解决方案. 典型模式 Sta ...

  9. 5月9日 python学习总结 外键、表之间的关联关系、修改表、清空表内容、复制表

    一.外键foreign key    外键约束: 1.必须先创建被关联表才能创建关联表 2.插入记录时,必须先插入被关联表的记录,才能插入关联表(要用到被关联表)的记录 3.若不设置同步更新和同步删除 ...

  10. CodeUp Problem D: More is better

    根据题目意思,输入的每一对A.B都是直接朋友,并且最后只会得到一个集合,该集合就是Mr Wang选择的男孩. 因此很容易写出代码,甚至不需要自己构建一个并查集,只需要使用C++的set模板,每次读入一 ...