找不到REST CXF和Spring cxf-extension-jaxrs-binding文件异常? [英] REST CXF and Spring cxf-extension-jaxrs-binding File not found exception?

查看:143
本文介绍了找不到REST CXF和Spring cxf-extension-jaxrs-binding文件异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CXF 2.6.0和spring 2.5.6开发REST Web服务,我在pom.xml中对CXF maven的依赖是:

<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>

我正在使用Spring 2.5.6,并且已经在applicationcontext中声明了我的Web服务.xml弹簧文件:

<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 


推荐答案

根据,对于cxf> 2.4.x,不再需要此文件。

According to this, this file is no longer required for cxf > 2.4.x.

这篇关于找不到REST CXF和Spring cxf-extension-jaxrs-binding文件异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆