报错:java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class.
来源:互联网 发布:淘宝客网站开发 编辑:程序博客网 时间:2024/06/14 13:57
今天在将一个SSM项目部署到linux服务器上时,启动tomcat时报错:
[QC] ERROR [localhost-startStop-1] org.springframework.web.context.ContextLoader.initWebApplicationContext(215) | Context initialization failedorg.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from file [/usr/local/tomcat/apache-tomcat-7.0.52/webapps/smart/WEB-INF/classes/spring/applicationContext-service.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) 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:4973) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)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) 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) ... 26 more
在百度之后,说是Spring包版本冲突了,但是这个项目使用的Maven进行管理,依赖中都是4.x版本的Spring,于是使用IDEA查看依赖关系图:
发现Dubbo依赖了一个Spring,并且版本是2.x的,于是排除这个依赖。
排除dubbo依赖的Spring:
重新部署项目,成功部署。
补充:百度上也有说将jdk8换成jdk7的,但是我试了试,并没有什么用,所以还是将低版本的Spring包排除最好。
阅读全文
1 0
- 报错:java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class.
- java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [or
- Context namespace element 'component-scan' and its parser class [org.springframework.context.annotat
- Context namespace element 'component-scan' and its parser class [org.springframework.context.annotat
- Context namespace element 'component-scan' and its parser class [org.springframework.context.annotat
- Context namespace element 'component-scan' and its parser class [org.springframework.context.annotat
- Context namespace element 'component-scan' and its parser class are only available on ....
- Context namespace element 'component-scan' its parser class are only available on JDK 1.5 and higher
- canal的使用错误“Context namespace element 'component-scan' and its parser class”
- Caused by: java.lang.IllegalStateException: Context namespace element 'annotation-config' and its pa
- Context namespace element xxx and its parser class [org.springframework.context.annotat Dubbo
- Spring报Context namespace element 'component-scan'... are only available on JDK 1.5 and higher解决问题
- namespace element 'annotation-config' and its parser class are only available on JDK 1.5 and higher
- Context namespace element 'component-scan' 提示 only available on JDK 1.5 and higher
- nested exception is java.lang.IllegalStateException: Context namespace element 'annotation-config' a
- Insight context:component-scan 实现class scan
- 报java.lang.IllegalStateException
- Spring 配置文件报错:元素 "context:component-scan" 的前缀 "context" 未绑定。
- scrapy抓取的中文结果乱码解决办法
- 下载软件 ==》BitComet(比特彗星)
- SPOJ
- 在CentOS7上安装SQL Server 2017
- jsp中四种传递参数的方法&&web中参数字符编码的修改统一
- 报错:java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class.
- 基于poi,将excel表转化为实体类列表的工具类
- 跳槽季:分享从事C#开发人员面试经验
- PyTorch学习2—Autograd: 自动微分法
- leetcode 492. Construct the Rectangle
- 3D转换(transform)
- 天天和不可描述
- 利用python做数据分析中如何理解列表,列表推导式
- 如何在Linux下安装screen