问题描述
我正在尝试配置jboss wildfly 8以使用Jackson for JSON。所以我添加了
I'm trying to configure jboss wildfly 8 to use Jackson for JSON. So I added
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>3.0.6.Final</version>
<type>jar</type>
</dependency>
到我的耳朵项目。但在部署时我得到以下错误:
to my ear project. But on deploying I get following error:
版本3.0.6与Wildfly不兼容吗?我怎么知道哪个版本有效?我也试过2.3.7和1.1,但总是一样的错误。
Is version 3.0.6 not compatible with Wildfly? how do I know which version works? I also tried with 2.3.7 and 1.1 but always the same error.
编辑:
我有一个ejb模块与pojos。在这里,我有依赖:
I have a ejb module with pojos. Here I have the dependency:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.2.3</version>
<scope>provided</scope>
<type>jar</type>
</dependency>
所以看起来非常像杰克逊2给我。
so that looks very much like jackson 2 to me.
在我看来,我有以下依赖:
and in my ear, I have following dependency:
<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吗?
do I need resteasy-jackson2-provider now? Do I need the jboss-deployment-structure.xml now?
推荐答案
WildFly 8已经包含了Jackson。使用< scope>提供< / scope>
标记依赖关系。然后,您需要添加,每个。
WildFly 8 already includes Jackson. Mark the dependency with <scope>provided</scope>
. You then need to add a jboss-deployment-structure.xml
to your deployment with the following per the 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>
这篇关于Wildfly和Jackson:LinkageError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!