Philipp
Philipp

Reputation: 4270

Wildfly 10 - How to use a newer version of jackson for an aplication

I have an application running on wildfly 10 that needs a newer version of jackson. Simply updating the maven dependency does not to work. Wildflys own version seems to interfere...

Somebody has a hint?

Upvotes: 5

Views: 2161

Answers (1)

rü-
rü-

Reputation: 2312

You can add a newer version of Jackson to your war and use that, but the JAX-RS subsystem of the container (Resteasy) will still use it's own jackson module to (de)serialize you HTTP request/response bodies.

You could add a module with the newer version, but you could run into dependency problems with other modules (see this pull request which already was accepted, so it should be in the next release, but I don't know of any planned Wildfly release dates).

Or you could package your own version of Jackson and register those MessageBodyReaders/Writers to be used by JAX-RS. This should do the job.

@Provider
public class CustomJacksonJsonProvider extends JacksonJsonProvider {}

You may also have to exclude the built-in Jackson by adding a jboss-deployment-structure.xml:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <exclusions>
            <module name="org.jboss.resteasy.resteasy-jackson-provider" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

Upvotes: 3

Related Questions