0

I try to use the com.fasterxml.jackson for my JSON Deserialization and Serialization. I put the dependencies for the com.fasterxml version in the pom.xml of my war-project and also added the org.jboss.resteasy.resteasy-jackson2-provider dependency there. However my WildFly throws the exception that it can not find the class org.codehouse.jackson.jaxrs.JacksonJsonProvider. I also tried excluding the resteasy-jackson-provider in my jboss-deployment-structure.xml and added the new resteasy-jackson2-provider as dependency with the service-attribute set to "import" as i found on some previous questions. None of this resolved my problem. The important files (hope i did not miss one):
Jboss-deployment-structure:

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

Dependencies from pom.xml:

<dependency>
  <groupId>org.jboss.resteasy</groupId>
  <artifactId>resteasy-jackson2-provider</artifactId>
  <version>3.0.10.Final</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-core</artifactId>
  <version>2.4.1</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-annotations</artifactId>
  <version>2.4.1</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>2.4.1</version>
  <scope>provided</scope>
</dependency>

EDIT: I noticed that there are several duplicate jars in my war (including the resteasy-jackson-provider). To fix this i tried to exclude as much general poms (for example wildfly-parent) from my poms as possible. I now have only the directly necessary dependencies in my poms and the issue still stands (multiple jars i did not include or include with the scope provided in my war). Does anybody have an idea why this might occure?
EDIT 2: Issue is fixed there was a problem with my maven script, which did not clean the war... stupid mistake by my part

Abbel
  • 320
  • 1
  • 9

2 Answers2

0

I faced the same problem too

Im' not really sure about it but when i tryed i found out that Wildfly has packaged all his module under javaee.api so you couldn't exclude any module or have to exclude all. You have to upgrade your Wildfly version and upgrade package.

I can tell you at least than in the most recent version they use fasterxml. So if you don't need a specific version of fasterXML's jackson, just upgrade wildfly.

Walfrat
  • 5,363
  • 1
  • 16
  • 35
  • Thank you for answering, but my problem was caused by me not cleaning the war properly via maven...it´s working now – Abbel Jan 28 '16 at 17:03
0

For anyone who arrives here I would like to comment that, for me, the key has been this exclusions, expecially important the second one:

<exclusions>
     <module name="org.jboss.resteasy.resteasy-jackson-provider"/>
    <module name="org.jboss.resteasy.resteasy-json-binding-provider"/>
</exclusions>

So, I hope this can be helpfull for somebody.