Wildfly 9 – How do I exclude Jackson

I just ran into this issue myself.

After upgrading a library in my application, I received the following error on a request:

Exception handling request to /path: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonParser.hasToken(Lcom/fasterxml/jackson/core/JsonToken;)

Here is how I solved it:

I obviously had to exclude jackson-core-2.5.1 that wildfly-9 provides.

I listed all modules that depend on ‘jackson-core’ with /opt/wildfly/modules# grep -R 'jackson-core'

Then I created a jboss-deployment-structure.xml in my WEB-INF folder:

<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <module name="com.fasterxml.jackson.core.jackson-core" />
            <module name="com.fasterxml.jackson.core.jackson-databind" />
            <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" />
            <module name="org.jboss.resteasy.resteasy-jackson2-provider" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

Leave a Comment