我遇到了与 Jackson 完全相同的问题,我使用它在我的 EAP 7 中使用它jboss-deployment-structure.xml
:
<jboss-deployment-structure>
<deployment>
<exclusions>
<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" />
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
</exclusions>
</deployment>
</jboss-deployment-structure>
看起来只要任何其他模块将 jackson 列为它们各自的依赖项module.xml
,它就不会被排除在外,而且 EAP 甚至不能对此发出警告。
编辑 2018-02-19:从 EAP 7.0.0 升级到 7.1.0 时,由于更新了 Jackson jar,事情再次中断。
这是堆栈跟踪的关键部分:
Caused by: javax.ejb.EJBException: WFLYEJB0442: Unexpected Error
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:185)
[...]
at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [wildfly-ee-7.1.0.GA-redhat-11.jar:7.1.0.GA-redhat-11]
... 11 more
Caused by: java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
[...]()Lcom/fasterxml/jackson/databind/ObjectMapper; @89: invokevirtual
Reason:
Type 'com/fasterxml/jackson/datatype/jdk8/Jdk8Module' (current frame, stack[1]) is not assignable to 'com/fasterxml/jackson/databind/Module'
所以我们也排除了这些:
<jboss-deployment-structure>
<deployment>
<exclusions>
<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.datatype.jackson-datatype-jdk8" />
<module name="com.fasterxml.jackson.datatype.jackson-datatype-jsr310" />
<module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" />
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
</exclusions>
</deployment>
</jboss-deployment-structure>