2011-06-14 162 views
16

我正在使用Apache CXF版本2.4.0。我正在尝试创建一个Restful服务。2.4.0中的Apache CXF RS扩展问题

下面的例子在2.3.4中工作,但在2.4.0中不起作用。我应该在bean配置文件中做什么不同?

当我在我的bean配置文件中包含下面的xml行时。

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

我得到以下堆栈跟踪错误:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml]

Offending resource: ServletContext resource [/WEB-INF/beans.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException:

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 at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)

我的POM依赖如下。这将适用于2.3.4,但不适用于2.4.0。有什么建议么?该xml扩展行是否被弃用或包含在另一个jar中?

<dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-bundle-jaxrs</artifactId> 
     <version>2.3.4</version> 
     <exclusions> 
      <exclusion> 
       <groupId>org.eclipse.jetty</groupId> 
       <artifactId>jetty-server</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 

回答

29

它已不再需要。在2.4.x中,大部分META-INF/cxf文件不再需要,可以删除。真的,cxf.xml是唯一需要的。

+0

它没有为我工作......我无法发送像我这样做时,我有Apache 2.2.3版本的JSON。将响应作为“响应类没有发现消息正文作者”。建议一些东西 – Bhuvan 2013-06-28 07:29:47