Resolve Spring Annotation Error: Componentscanbeandefinitionparser are only available on JDK 1.5 and higher

Source: Internet
Author: User
Using spring under JDK1.8,TOMCAT8, the following error occurred at startup.

OCT, 2016 11:18:31 AM org.springframework.web.context.ContextLoader initwebapplicationcontext severe:context Initialization failed org.springframework.beans.factory.BeanDefinitionStoreException:Unexpected exception parsing XML document from File [C:\xuhongkai\java\MyWorkspace\program\apache-tomcat-8.0.33\webapps\myHelloWorld\WEB-INF\ Classes\applicationcontext-dao.xml]; Nested exception is Java.lang.IllegalStateException:Context namespace element ' Component-scan ' and its parser class [Org. Springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available in JDK 1.5 and higher at ORG.SP Ringframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions (xmlbeandefinitionreader.java:420 ) at Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions ( xmlbeandefinitionreader.java:342) at Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions (Xmlbeandefinitionreader.java : 310) at Org.springframework.beanS.factory.support.abstractbeandefinitionreader.loadbeandefinitions (abstractbeandefinitionreader.java:143) at Org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions ( abstractbeandefinitionreader.java:178) at Org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions ( abstractbeandefinitionreader.java:149) at Org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions ( xmlwebapplicationcontext.java:124) at Org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions ( xmlwebapplicationcontext.java:92) at Org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory ( abstractrefreshableapplicationcontext.java:123) at Org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory ( abstractapplicationcontext.java:422) at Org.springframework.context.support.AbstractApplicationContext.refresh ( Abstractapplicationcontext.java:352) at Org.springframework.web.context.ContextLoader.createWebApplicationContext (contextloader.java:255) at Org.springframework.web.context.ContextLoader.initWebApplicationContext (contextloader.java:199) at Org.springframework.web.context.ContextLoaderListener.contextInitialized (contextloaderlistener.java:45) at Org.apache.catalina.core.StandardContext.listenerStart (standardcontext.java:4811) at Org.apache.catalina.core.StandardContext.startInternal (standardcontext.java:5251) at Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:147) at org.apache.catalina.core.containerbase$ Startchild.call (containerbase.java:1408) at Org.apache.catalina.core.containerbase$startchild.call ( containerbase.java:1398) at Java.util.concurrent.FutureTask.run (Unknown Source) at Java.util.concurrent.ThreadPoolExecutor.runWorker (Unknown Source) at java.util.concurrent.threadpoolexecutor$ Worker.run (Unknown source) at Java.lang.Thread.run (Unknown source) caused By:java.lang.IllegalStateEXception:context namespace element ' Component-scan ' and its parser class [ Org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available in JDK 1.5 and higher at or G.springframework.context.config.contextnamespacehandler$1.parse (contextnamespacehandler.java:65) at Org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse (namespacehandlersupport.java:69) at Org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement ( beandefinitionparserdelegate.java:1297) at Org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement ( beandefinitionparserdelegate.java:1287) at Org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions ( defaultbeandefinitiondocumentreader.java:135) at Org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions ( defaultbeandefinitiondocumentreader.java:92) at Org.springframework.beans.factory.xml.XmlBeanDefinitionreader.registerbeandefinitions (xmlbeandefinitionreader.java:507) at Org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions ( xmlbeandefinitionreader.java:398) ... More

On the Internet, the Springframework.context-supported JDK version in spring is 1.7 (included) below, and I can't do it with 1.7 and 1.6, and then I put Tomcat down, use TOMCAT6, re-establish the Web project, and start successfully.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.