Problem with excluding built-in jackson provider
arash1988 Jan 27, 2014 8:07 PMHello everybody,
I am developing a straightforward maven-based JavaEE application in IntelliJ IDEA, and obviously I would like to use Wildfly 8 for both development and production. I simply need to expose some entities through some RESTful web services. Those entities have bidirectional relationships, which leads to a loop when they are going to be serialized into JSON.
Newer versions of Jackson are able to handle this kind of situation with a special annotation. To get that to work, I need to exclude Wildfly's built-in JSON serializer / jackson provider / whatever it is and use the newer version that comes bundled with my application. I have followed the instructions I have found on the web and came up with this jboss-deployment-structure.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.codehaus.jackson.jackson-jaxrs" />
<module name="org.codehaus.jackson.jackson-core-asl" />
<module name="org.codehaus.jackson.jackson-mapper-asl" />
<module name="org.codehaus.jackson.jackson-xc" />
</exclusions>
</deployment>
</jboss-deployment-structure>
The problem is, it doesn't work. Even when I set my pom.xml to something like this:
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId>
<version>3.0.6.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
which clearly indicates that nothing should come bundled with my application, I still get this StackOverflowError (caused by the infinite loop) which roots in org.codehaus.jackson package. This is turn means that built-in version of Jackson is still in the works and is not excluded. How can I fix this?
Thanks in advance.