Reputation: 135
We have a web application that used to be deployed as a war in Jboss AS 7 . This webapp uses both reasteasy and jackson( 2.0 ) to serialize and deserealize data from a mongodb database. Some time ago we had to separate the webapp into 2 different maven modules , and API (jar) and WAR . all our POJOs were on the jar module . The problem is that all the jackson annotation became useless. They are just completely ignored . More info jboss-deployment-structure.xml :
<exclusions>
<module name="org.codehaus.jackson.jackson-core-asl"/>
<module name="org.codehaus.jackson.jackson-mapper-asl"/>
</exclusions>
POM (API)
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
POM(WAR)
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
I read that reasteasy modules and jackson modules could somehow conflict since resteasy could be using some old jackson version . How can i check this ? Or is this a problem of the jboss classloaders ? (Jackson 2 annotations ignored in EJB Jar with JBoss (6.2.0 GA))
Upvotes: 1
Views: 856
Reputation: 10586
@NokusFerreira, basically you are correct. I know this is an old question, but I hope this answer will help somebody.
Since you haven't told when problem occurs (during serialization in JAR or during deserialization in WAR). I'm guessing that during deserialization inside WAR module.
If yes, then your WAR is probably using resteasy-client
and resteasy-jackson-provider
, and here problem lies - because to work with Jackson 2.x RESTEasy needs a different module: resteasy-jackson2-provider
(please note "2" suffix) instead of old resteasy-jackson-provider
.
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId>
<version>3.0.11.Final</version>
</dependency>
But unfortunatelly, resteasy-jackson2-provider
is not bundled with JBoss 7.1.
So basically you have following options:
It is a common inconvenience in a JEE world, that libraries declared as your dependencies are provided by the application server (and may differ from ones that you are thinking you are using).
EDIT
Also this answer may be useful: How to make Resteasy 2.3.6 use Jackson 2.+
Upvotes: 1