cxf3.0+spring4.0.5错误

学习配置cxf+spring,按部就班老的方法配置,出现如下错误

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/cxf/cxf-extension-soap.xml]
Offending resource: class path resource [beans.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [META-INF/cxf/cxf-extension-soap.xml]; nested exception is java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-soap.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)

这里只贴出了错误的关键部分,主要是说找不到META-INF/cxf/cxf-extension-soap.xml这个东西。在老的配置方式里我们这样

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

import了三个xml文件,在3.0版本之前这三个文件都是在cxf-core下的META-INF/cxf/目录下,排查各种原因后发现在3.0的核心包即cxf-core下没有了

<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

这两个xml文件

其实在2.7版本的时候<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />这句话就可以不加了,应为这里面没有东西,那现在原因找到了,只要去了

<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

这两句话就ok了

posted @ 2018-08-16 14:07  Thinking丶途  阅读(332)  评论(0编辑  收藏  举报