9

I'm running into a Jackson serialization issue with null values in maps. Apparently this is a known bug in the Jackson version used by Wildfly 9 (https://issues.jboss.org/browse/WFLY-4906). I'd like to use the current version of Jackson; however, I'm having trouble excluding the version used by Wildfly. I tried excluding the module in jboss-deployment-structure.xml but the exclusion is not working.

jboss-deployment-structure.xml

Any idea how I can get this to work?

Julien Kronegg
  • 4,968
  • 1
  • 47
  • 60
user3029642
  • 909
  • 3
  • 10
  • 23

2 Answers2

29

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>
Marty
  • 974
  • 9
  • 25
  • 1
    Thanks. I solved it the same way and forgot to update the ticket. – user3029642 Jan 07 '17 at 00:02
  • 2
    You solve my entire life. Seriously. You solved it. Thanks! – Tirias Mar 09 '17 at 15:42
  • 1
    It works with Wildfly 10.1.0 Final version - and it save my faith. – aarexer Feb 01 '18 at 21:15
  • 1
    It works with JBoss EAP 7.1.6 - and you saved my day. Now I will always use grep -R '' in the modules folder, if I run into similar issues. (had some in the past...) – chux Jun 21 '21 at 08:12
  • Do I need to configure somewhere for my jboss or my server to point to this `jboss-deployment-structure.xml` ? I try to create a `jboss-deployment-structure.xml` in my WebContent/WEB-INF/ and put in the same content, restart my server, still no effect. – Panadol Chong Apr 15 '22 at 01:53
  • @PanadolChong I did no such thing. – Marty Apr 15 '22 at 07:23
  • This isn't working for wildfly 21, OpenJDK 11 and Spring boot 2.7 web deployment, jackson jars coming with Springboot. what did i miss? – Haseeb Jul 05 '23 at 07:52
8

I had similar issue. I had to exclude whole jax-rs subsytem

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
    <exclude-subsystems>
        <subsystem name="jaxrs" />
    </exclude-subsystems>
    ...
</deployment>

after that I was able to use my version of Jackson.

podmak
  • 151
  • 5