In the programmer career, the most mentioned should be the three big SSH framework. As the first big frame of the spring framework, we often use it.
However, in the use of the process, encountered a lot of common anomalies, I summarize here, we encourage each other.
One, the exception for the configuration file could not be found
[Plain]View Plaincopy
- 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 is opened because it does not exist
Explanation: This means that, without looking for the configuration file for the controller's XML, modify the configuration file name.
[HTML]View Plaincopy
- <init-param>
- <param-name>contextconfiglocation</param-name>
- <param-value>classpath:com/herman/ss/config/testajax.xml</param-value >
- </init-param>
second, the namespace configured in XML does not find the corresponding schema exception
[Plain]View Plaincopy
- Nested exception is org.xml.sax.saxparseexception:cvc-complex-type.2.4.c:the matching wildcard is strict,
- But no declaration can is found for element ' util:list '.
Xmlns:util= "Http://www.springframework.org/schema/util" is removed because util naming is not present in the schema
third, can not find the exception of Jackson.jar
[Plain]View Plaincopy
- Standardwrapper.throwable
- Java.lang.noclassdeffounderror:org/codehaus/jackson/jsonprocessingexception
Missing Jackson's jar package, import Jackson-all-1.9.5.jar
Iv. Bean is not the only exception
[Plain]View Plaincopy
- 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 configured multiple beans, we are still using Ctx.getbean (Person.class), which is to get the Bean object based on the bean's class map. The Bean object returned at this time is not unique and has multiple bean objects. The workaround is to get the Bean object based on the bean's ID.
V. Missing log jar Package
[Plain]View Plaincopy
- Java.lang.noclassdeffounderror:org/apache/commons/logging/logfactory
- caused by:java.lang.ClassNotFoundException:org.apache.commons.logging.LogFactory
The problem is that the project lacks spring-dependent jar package files. Solution: Join Commons-logging-1.1.3.jar.
Six. Bean exception not found
[Plain]View Plaincopy
- Org.springframework.beans.factory.NoSuchBeanDefinitionException:No Bean named ' filter2 ' is defined
The problem is that a bean with name Filter2 is not found in the project. To be blunt is to find the bean with ID filter2 in Applicationcontext.xml, configure it.
Vi. Lack of Spring-webmvc-4.0.6.release.jar package
[Plain]View Plaincopy
- Severity: Error Loading WebappClassLoader
- Context:/struts_spring_project
- Delegate:false
- Repositories:
- /web-inf/classes/
- ----------> Parent Classloader:
- [Email protected]
- Org.springframework.web.servlet.DispatcherServlet
- Java.lang.ClassNotFoundException:org.springframework.web.servlet.DispatcherServlet
Solution: Add Spring's MVC rack package to your project. If my spring version is 4.0.6, then add the Spring-webmvc-4.0.6.release.jar in.
Vii. Lack of Spring-aop-4.0.6.release.jar package
[Plain]View Plaincopy
- Java.lang.noclassdeffounderror:org/springframework/aop/targetsource
- Java.lang.ClassNotFoundException:org.springframework.aop.TargetSource
Solution: Add Spring's AOP rack package to your project. If my spring version is 4.0.6, then add the Spring-aop-4.0.6.release.jar in.
Viii. Lack of Spring-expression-4.0.6.release.jar package
[Plain]View Plaincopy
- Java.lang.noclassdeffounderror:org/springframework/expression/expressionparser
- Java.lang.ClassNotFoundException:org.springframework.expression.ExpressionParser
Solution: Add spring's expression rack package to your project. If my spring version is 4.0.6, then add the Spring-expression-4.0.6.release.jar in.
The name of the bean, name or ID, or alias aliases already exist.
[Plain]View Plaincopy
- Org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
- Configuration problem:bean name ' A ' is already used in this <beans> element
Workaround: Change the name of the duplicate to a name.
X. The bean's automatic loading cannot find the corresponding bean problem
[Plain]View Plaincopy
- Org.springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying Bean of type [Com.yyc.ym.biz.YycBiz] Found for dependency:expected at least 1 beans which qualifies as Autowire candidate for this dependency. Dependency annotations: {@org. springframework.beans.factory.annotation.Autowired (Required=true)}
Workaround: Add default-autowire= "ByName" default-lazy-init= "true" to the <beans> root node in the configuration file or <context:component-scan Base-package= "com.xxx.dao.*" ></context:component-scan> package below with * match
SPRING10 Common anomaly resolution method