2011-06-14 38 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