Caused by: java.lang.IllegalStateException: Context namespace element 'annotation-config' and its pa
2017-02-09 10:24
573 查看
问题:运行测试TC时报错,org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:configuration/server/spring-servertest.xml]Offending resource: class path resource [configuration/O2O-applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [configuration/server/spring-servertest.xml];nested exception is java.lang.IllegalStateException: Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser] are only available on JDK 1.5 and higherat org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76) Caused by: java.lang.IllegalStateException: Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser] are only available on JDK 1.5 and higher原因:使用的Spring版本是2.5.6,jdk是1.8,把1.8版本作为了1.4版本,导致报错。升级Spring版本到3.0.6可以解决解决方式:1)升级Spring版本由2.5.6到3.0.6.RELEASE2)新增Spring-orm依赖,版本需要和Spring-beans依赖保持一致
Spring相关依赖如下:
<dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>3.0.6.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>3.0.6.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId><version>3.0.6.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>3.0.6.RELEASE</version></dependency>
相关文章推荐
- spring低版本报错:java.lang.IllegalStateException: Context namespace element ‘annotation-config’ and its parser class [*] are only available on
- nested exception is java.lang.IllegalStateException: Context namespace element 'annotation-config' a
- 报错:java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class.
- Context namespace element 'annotation-config' and its parser class [org.springframework.context.anno
- java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [or
- canal的使用错误“Context namespace element 'component-scan' and its parser class”
- Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser]
- Caused by: java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.fi
- Caused by: java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required()
- Caused by: java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAut
- (crm-bug)Spring/Java error: namespace element 'annotation-config' … on JDK 1.5 and higher
- Caused by: java.lang.ClassNotFoundException: org.aspectj.lang.annotation.Around
- Caused by: java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getServletContext()Lja
- Caused by: java.lang.NoSuchMethodError:javax.servlet.http.HttpServletRequest.getServletContext()L
- java.lang.IllegalArgumentException: <session-config> element is limited to 1 occurrence
- Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/WebApplicationContext
- Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android
- Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/WebApplicationContext
- Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android
- Exception in thread "main" java.lang.NoClassDefFoundError: org.jaxen.NamespaceContext