项目启动遇到一个新问题Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext.xml]; nested exception is java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) ~[spring.jar:2.5.6.SEC01]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) ~[spring.jar:2.5.6.SEC01]
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92) ~[spring.jar:2.5.6.SEC01]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123) ~[spring.jar:2.5.6.SEC01]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422) ~[spring.jar:2.5.6.SEC01]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) ~[spring.jar:2.5.6.SEC01]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) ~[spring.jar:2.5.6.SEC01]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) ~[spring.jar:2.5.6.SEC01]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) ~[spring.jar:2.5.6.SEC01]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5157) ~[catalina.jar:7.0.92]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5680) ~[catalina.jar:7.0.92]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) ~[catalina.jar:7.0.92]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018) ~[catalina.jar:7.0.92]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994) ~[catalina.jar:7.0.92]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) ~[catalina.jar:7.0.92]
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1900) ~[catalina.jar:7.0.92]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_201]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_201]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_201]
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) ~[tomcat-coyote.jar:7.0.92]
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) ~[?:1.8.0_201]
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) ~[?:1.8.0_201]
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:619) ~[catalina.jar:7.0.92]
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:566) ~[catalina.jar:7.0.92]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_201]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_201]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_201]
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301) ~[tomcat-coyote.jar:7.0.92]
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) ~[?:1.8.0_201]
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) ~[?:1.8.0_201]
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) ~[?:1.8.0_201]
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) ~[?:1.8.0_201]
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) ~[?:1.8.0_201]
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) ~[?:1.8.0_201]
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) ~[?:1.8.0_201]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_201]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_201]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_201]
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) ~[?:1.8.0_201]
at sun.rmi.transport.Transport$1.run(Transport.java:200) ~[?:1.8.0_201]
at sun.rmi.transport.Transport$1.run(Transport.java:197) ~[?:1.8.0_201]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_201]
at sun.rmi.transport.Transport.serviceCall(Transport.java:196) ~[?:1.8.0_201]
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573) ~[?:1.8.0_201]
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834) ~[?:1.8.0_201]
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688) ~[?:1.8.0_201]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_201]
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687) [?:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher

at org.springframework.context.config.ContextNamespaceHandler$1.parse(ContextNamespaceHandler.java:65) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507) ~[spring.jar:2.5.6.SEC01]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398) ~[spring.jar:2.5.6.SEC01]
... 58 more

 

 

今天使用IDEA启动老Eclipse项目,各种配置改完后,启动项目出现这个错误。因为自己使用的JDK版本是1.8的,而spring旧版本默认扫描到jdk1.7的版本,所以出现了这个错误。

重新下载了一个jdk1.7,然后重启项目后就正常了。PS:记得把IDEA相关JDK配置修改下

猜你喜欢

转载自www.cnblogs.com/goodShare-orz/p/10373282.html
0条评论
添加一条新回复