我的应用程序使用版本2.8.2的Jackson库,我在我的WAR文件中添加了WEB-INF/LIB
目录。由于我的WildFly(10.0.0.Final)也包含杰克逊库(旧版本),我决定不在jboss-deployment-structure.xml
文件中排除它们,如下所示:
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<subsystem name="resteasy" />
</exclude-subsystems>
<exclusions>
<module name="org.jboss.resteasy" />
<module name="org.apache.httpcomponents" />
<module name="com.fasterxml.jackson.core.jackson-core" />
<module name="com.fasterxml.jackson.core.jackson-annotations" />
<module name="com.fasterxml.jackson.core.jackson-databind" />
<module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" />
</exclusions>
</deployment>
</jboss-deployment-structure>
但是我的应用程序没有部署,WildFly会抛出以下错误:
Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.SerializationConfig.withDefaultPrettyPrinter(Lcom/fasterxml/jackson/core/PrettyPrinter;)Lcom/fasterxml/jackson/databind/SerializationConfig;
at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:86)
at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:67)
at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:63)
似乎WildFly没有正确排除杰克逊图书馆。请帮忙。