2012-05-23 80 views
6

我正在trynig开发利用CXF 2.6.0和2.5.6春季在pom.xml我CXF行家扶养一个REST Web服务是:使用Spring 2.5REST CXF和Spring cxf-extension-jaxrs-binding文件未找到异常?

<dependency> 
    <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-rs-extension-providers</artifactId> 
    <version>2.6.0</version> 
    </dependency> 

<dependency> 
    <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-rs-extension-search</artifactId> 
    <version>2.6.0</version> 
</dependency> 

我'。 6,我已经宣布在applicationContext.xml春天文件我的web服务:

<jaxrs:server id="restContainer" address="/sav"> 
    <jaxrs:serviceBeans> 
     <ref bean="wssav"/> 
    </jaxrs:serviceBeans> 
</jaxrs:server> 

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

,我有这个代码中声明我的Web服务到web.xml文件:

<servlet> 
    <servlet-name>CXFServlet</servlet-name> 

    <servlet-class> 
     org.apache.cxf.transport.servlet.CXFServlet 
    </servlet-class> 
    <load-on-startup>1</load-on-startup> 
</servlet> 
<servlet-mapping> 
    <servlet-name>CXFServlet</servlet-name> 
    <url-pattern>/rest/*</url-pattern> 
</servlet-mapping> 

当我在Tomcat上部署项目中,我得到这个例外进口的applicationContext.xml文件第二个文件:

java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-jaxrs-binding.xml] cannot be opened because it does not exist 
+0

或者,您可以检查Tomcat Plus是否已与CXF集成(还有一些其他内容)。 /tomee.apache.org –

回答

12

根据this,这个文件不再需要CXF > 2.4.x.

1

我也得到完全相同的错误。我正的错误是 -

IOException parsing XML document from class path resource [META-INF/cxf/cxf-extension-jaxrs-binding.xml]; 
nested exception is java.io.FileNotFoundException: 
class path resource [META-INF/cxf/cxf-extension-jaxrs-binding.xml] cannot be opened because it does not exist. 

即使我读了CXF的新版本并不需要比CXF-RT-前端-JAXRS的任何其他。我得到了这些错误后,我在我的POM文件添加以下的依赖,但他们没有帮助 -

<dependency> 
    <groupId>org.apache.cxf</groupId> 
    <artifactId>cxf-rt-frontend-jaxrs</artifactId> 
    <version>2.6.2</version> 
</dependency> 
<dependency> 
    <groupId>org.apache.cxf</groupId> 
    <artifactId>cxf-rt-rs-extension-providers</artifactId> 
    <version>2.6.2</version> 
</dependency> 
<dependency> 
    <groupId>org.apache.cxf</groupId> 
    <artifactId>cxf-rt-rs-extension-search</artifactId> 
    <version>2.6.2</version> 
</dependency> 

我也弄不明白,为什么几乎所有的教程,详细介绍了构建基于CXF REST服务措施的原因希望你能包括以下春天配置3号线(当我不可能在任何地方找到这些文件) -

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

尝试移除进口CXF波及JAXRS-binding.xml行。 其他2个xml文件位于cxf-X.Y.Z.jar中。 对我来说就是cxf-2.7.7.jar。

0

文件META-INF/cxf/cxf-extension-jaxrs-binding.xml在以下工件中可用。

<groupId>org.apache.cxf</groupId> 
<artifactId>cxf-rt-frontend-jaxrs</artifactId> 
<version>2.2.7</version> 
0

在applicationContext.xml中,注释掉下面的导入在cxf 3.1.10中适用于我。 import resource =“classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml