Article From:https://www.cnblogs.com/wuxu/p/9969086.html
1. The exception of the configuration file could not be found
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 existInterpretation: This means that instead of looking for XML with the configuration file as controller, just change the name of the configuration file.
<init-param> 
<param-name>contextConfigLocation</param-name> 
<param-value>classpath:com/herman/ss/config/testAjax.xml</param-value>
</init-param>
2. The namespace configured in XML cannot find the corresponding Schema exception nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4C: The matching wildcard is strict, but no declaration can be found for element’util: list’.xmlns:uTil= “http://www.springframework.org/schema/util” is removed because util naming does not exist in schema
3. The exception of jackson.jar, StandardWrapper.Throwable, could not be found
java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonProcessingException
Without jackson’s jar package, import jackson-all-1.9.5.jar
4. Beans are not the only exception
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)The exception is that after a class has multiple beans configured, we still use ctx. getBean (Person. class); the method is to get the bean object according to the class mapping of the bean. The bean object returned at this time is not unique, there are manyBean object. The solution is to get the bean object according to the ID of the bean.
5. Lack of log jar packages
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactoryCaused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactoryThe problem is that there is a lack of spring-dependent jar package files in the project. Solution: Add commons-logging-1.1.3.jar.
6. Bean exception not found
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘filter2’ is definedThe problem is that you cannot find a bean whose name is filter 2 in the project. To put it bluntly, you can’t find a bean with the ID of filter 2 in the application Context. xml, just configure it. 6. Lack of spring-webMvc-4.0.6. RELEASE.jar package
Serious: Error loading WebappClassLoader context: Struts_Spring_Project delegate: false repositories:/WEB-INF/classes/——–> Parent Classloader: org.apache.catalina.loader.Standard ClassLoadeR@b33d0a org.spring framework.web.servlet.Dispatcher Servlet java.lang.ClassNotFoundException:org.spriNgframework. web. servlet. Dispatcher Servlet
Solution: Spring’s MVC package can be added to the project. If my spring version is 4.0.6, add spring-webmvc-4.0.6.RELEASE.jar.
7. Lack of spring-aop-4.0.6. RELEASE.jar package
java.lang.NoClassDefFoundError: org/springframework/aop/TargetSource
java.lang.ClassNotFoundException: org.springframework.aop.TargetSourceSolution: Add spring’s AOP package to the project. If my spring version is 4.0.6, add spring-aop-4.0.6.RELEASE.jar.
8. Lack of spring-expression-4.0.6. RELEASE.jar package
java.lang.NoClassDefFoundError: org/springframework/expression/ExpressionParser
java.lang.ClassNotFoundException: org.springframework.expression.ExpressionParser
Solution: Spring’s expression package can be added to the project. If my spring version is 4.0.6, add spring-expression-4.0.6.RELEASE.jar.
9. The name or ID of the bean or alias already exists
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Bean name ‘a’ is already used in this <beans> element
Solution: Change the duplicate name to another name.
10. The automatic loading of beans can not find the corresponding bean problem
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)}Solution: Add default-autowire= “byName” default-lazy-init= “true” or & lt; context: compon under the root node.Ent-scan base-package= “com.xxx.dao. *” & gt; & lt; / context: component-scan & gt; matching under package with *

Leave a Reply

Your email address will not be published. Required fields are marked *