gpt4 book ai didi

jboss - Wildfly 和 jackson : LinkageError

转载 作者:行者123 更新时间:2023-12-04 10:02:08 26 4
gpt4 key购买 nike

我正在尝试将 jboss wildfly 8 配置为将 Jackson 用于 JSON。所以我加了

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>3.0.6.Final</version>
<type>jar</type>
</dependency>

到我的耳朵项目。但是在部署时出现以下错误:

Caused by: java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.jboss.resteasy.plugins.providers.jackson.ResteasyJacksonProvider$Proxy$_$$WeldClientProxy.disable(Lorg/codehaus/jackson/map/Des erializationConfig$Feature;Z)Lorg/codehaus/jackson/jaxrs/JacksonJsonProvider;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/jboss/resteasy/plugins/providers/jackson/ResteasyJacksonPr ovider$Proxy$$$WeldClientProxy, and its superclass loader (instance of org/jboss/modules/ModuleClassLoader), have different Class objects for the type sy.plugins.providers.jackson.ResteasyJacksonProvider$Proxy$$$_WeldClientProx y.disable(Lorg/codehaus/jackson/map/DeserializationConfig$Feature;Z)Lorg/codehaus/jackson/jaxrs/JacksonJsonProvider; used in the signature



3.0.6 版本与 Wildfly 不兼容吗?我怎么知道哪个版本有效?我也尝试了 2.3.7 和 1.1,但总是出现同样的错误。

编辑:

我有一个带有 pojos 的 ejb 模块。这里我有依赖:
    <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.2.3</version>
<scope>provided</scope>
<type>jar</type>
</dependency>

所以这对我来说很像 jackson 2。

在我耳边,我有以下依赖:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>3.0.6.Final</version>
<type>jar</type>
<scope>provided</scope>
</dependency>

我现在需要 resteasy-jackson2-provider 吗?我现在需要 jboss-deployment-structure.xml 吗?

最佳答案

WildFly 8 已经包含了 Jackson。用 <scope>provided</scope> 标记依赖关系.然后您需要添加 jboss-deployment-structure.xml 根据 documentation 将以下内容添加到您的部署中.

<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.jboss.resteasy.resteasy-jackson-provider"/>
</exclusions>
<dependencies>
<module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import"/>
</dependencies>
</deployment>
</jboss-deployment-structure>

关于jboss - Wildfly 和 jackson : LinkageError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22183809/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com