【问题标题】:Wildfly Swarm and cxf-rt-transports-httpWildfly Swarm 和 cxf-rt-transports-http
【发布时间】:2017-01-05 15:20:33
【问题描述】:

我正在尝试将我的项目从 EAP 6.3 转换为 Wildfly Swarm...

我在使用 CXF 时遇到了一些问题。

我有分数依赖:

<dependency>
  <groupId>org.wildfly.swarm</groupId>
  <artifactId>camel-cxf</artifactId>
</dependency>

然后,我将其包含在内,否则我的骆驼处理器代码中会出现"package org.apache.cxf.message does not exist" 错误

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>3.1.9</version>
    </dependency>

所以如果我包含它,我会收到错误:

在 ws 端点中检测到 Apache CXF 库 (cxf-core-3.1.9.jar) 部署;要么提供适当的部署替代嵌入式 具有容器模块依赖项的库或禁用 当前部署的 webservices 子系统添加适当的 jboss-deployment-structure.xml 描述符。前一种方法 推荐,因为后一种方法会导致大多数 web 服务 要禁用 Java EE 和任何 JBossWS 特定功能。

好的,也许camel-cxf 模块和我的jar 之间存在lib 冲突...或者它没有拾取我的jboss-deployment-structure.xml 文件?

我已经按照其他帖子的建议尝试了一些方法。

我尝试将其添加到 ${basedir}/src/main/webapp/WEB-INF 下的 jboss-deployment-structure.xml 中,并将 xml 文件添加到 maven-war-plugin 的 webResources 中。

  <deployment>
    <exclude-subsystems>
        <subsystem name="webservices" /> 
    </exclude-subsystems>  
  </deployment>

我也尝试将其添加到 jboss-deployment-structure.xml:

<dependencies>
    <module name="org.apache.cxf" />
    <module name="org.apache.cxf.impl" />
</dependencies>

但我不断收到该错误。所以我不确定如何解决这个冲突。有什么想法吗?

【问题讨论】:

    标签: jboss cxf wildfly wildfly-10 wildfly-swarm


    【解决方案1】:

    一种方法是使用 Jboss 提供的 CXF 库并将 &lt;scope&gt;provided&lt;/scope&gt; 设置为 cxf-rt-transports-http,以便编译但不打包 CXF 依赖项。

    您可以在Jboss specific configuration 上找到更多信息

    【讨论】:

    • 我现在已经尝试了很多东西,但仍然找不到库。 camel-core.jar 在 uberjar 的 m2repo 中,Eclipse 在 Maven Dependencies 下显示它。但我得到 org.apache.camel.* 的 java.lang.NoClassDefFoundError
    • 啊。我删除了除了 camel-cxf 之外的所有依赖项,并且没有收到错误消息。奇数。
    • 这就是我的意思,使用 JBoss 提供的 CXF 库,不要将它们打包到您的应用程序中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-09
    • 2016-07-24
    相关资源
    最近更新 更多