Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
815 views
in Technique[技术] by (71.8m points)

Wildfly 9 - How do I exclude Jackson

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...