【问题标题】:Apache CXF RS Extensions issue in 2.4.02.4.0 中的 Apache CXF RS 扩展问题
【发布时间】:2011-06-14 20:05:18
【问题描述】:

我使用的是 Apache CXF 2.4.0 版。我正在尝试创建一个 Restful 服务。

以下示例适用于 2.3.4,但不适用于 2.4.0。我应该在 beans 配置文件中做些什么不同的事情?

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

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

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

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: 配置问题:无法 从 URL 导入 bean 定义 地点 [类路径:META-INF/cxf/cxf-extension-jaxrs-binding.xml]

违规资源:ServletContext 资源[/WEB-INF/beans.xml];嵌套的 例外是 org.springframework.beans.factory.BeanDefinitionStoreException:

IOException 解析 XML 文档来自 类路径资源 [META-INF/cxf/cxf-extension-jaxrs-binding.xml]; 嵌套异常是 java.io.FileNotFoundException:类 路径资源 [META-INF/cxf/cxf-extension-jaxrs-binding.xml] 无法打开,因为它没有 存在于 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>

【问题讨论】:

    标签: rest cxf


    【解决方案1】:

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

    【讨论】:

    • 它对我不起作用......我无法像我在使用 apache 2.2.3 版本时那样发送 json。获取响应为“未找到响应类的消息正文编写器”。提出一些建议
    【解决方案2】:

    这里是关于在 2.4 及更高版本的 spring 中嵌入 cxf 的 CXF 信息。 http://cxf.apache.org/docs/embedding-cxf-inside-spring.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-23
      • 2013-12-18
      • 1970-01-01
      • 1970-01-01
      • 2013-06-17
      相关资源
      最近更新 更多