Ten common abnormal spring

First, you can not find the abnormal profile

[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 be opened because it does not exist  

Explanation: This meant that, did not find the configuration file for the controller of xml , modify the configuration file name can be.

[html] view plaincopy

 

<init-param>  

    <param-name>contextConfigLocation</param-name>  

    <param-value>classpath:com/herman/ss/config/testAjax.xml</param-value>  

</init-param>  

Second, in the xml configuration not found in a namespace corresponding to Schema abnormality

[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 be found for element 'util:list'.  

xmlns: util = "http://www.springframework.org/schema/util" removed, because schema does not exist util named

Third, can not find jackson.jar exception

[plain] view plaincopy

 

StandardWrapper.Throwable  

java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonProcessingException  

Lack jackson the jar package, introduced jackson-all-1.9.5.jar to

Four, 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)  

This exception is to say, a class configured with multiple bean later, we are still using ctx.getBean (Person.class); methods that, according to bean to acquire class map bean object. This time the returned bean object is not unique, there are multiple bean objects. The solution is based on bean 's id to get bean object.

Fifth, the lack of logs 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 is missing from the spring dependent jar package file. Solution: Add commons-logging-1.1.3.jar can be.

Six, can not find the bean abnormal

[plain] view plaincopy

 

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'filter2' is defined  

The problem is that the project can not find the name as filter2 the bean . It means in applicationContext.xml could not find the id is filter2 the bean , you can configure the look.

Sixth, the lack of spring-webmvc-4.0.6.RELEASE.jar package

[plain] view plaincopy

 

严重: 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.DispatcherServlet  

java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet  

Solution: Add in the project spring of mvc shelf package can be. As my spring version 4.0.6 , then put the spring-webmvc-4.0.6.RELEASE.jar added to it can be.

Seven, the 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 in the project spring of aop shelf package can be. As my spring version 4.0.6 , then put the spring-aop-4.0.6.RELEASE.jar added to it can be.

Eight, the 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 in the project spring of expression frame package can be. As my spring version 4.0.6 , then put the spring-expression-4.0.6.RELEASE.jar added to it can be.

Nine, bean name name or id or alias alias already exists

[plain] view plaincopy

 

org.springframework.beans.factory.parsing.BeanDefinitionParsingException:  

 Configuration problem: Bean name 'a' is already used in this <beans> element  

Solution: repeat the name change of name can be.

Ten, bean autoloader can not 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 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}  

Solution: In the configuration file <beans> root node plus default-autowire = "byName" default -lazy-init = "true" or <context:. Component-scan base -package = "com.xxx.dao * "> </ context: component- scan> package with the following * match

 

Guess you like

Origin www.cnblogs.com/had1314/p/10991822.html