Payara 5启动时的Spring MVC Jackson异常



我的应用程序使用以下内容:
JDK版本:Open JDK
JDK -11.0.11+9
Payara: 5.2021.5
Spring版本:5.2.7。RELEASE
jackson version: 2.9.4。


Payara 5.2021.5使用Jackson版本2.10.2,而应用程序使用Jackson版本:2.2.9.4。看起来SpringMVC使用的一些Jackson方法的方法签名在Jackson 2.10.2中发生了变化。

在服务器启动时,抛出以下异常:

Details: Location: org/springframework/http/converter/json/Jackson2ObjectMapperBuilder$XmlObjectMapperInitializer.create
(Lcom/fasterxml/jackson/core/JsonFactory;)Lcom/fasterxml/jackson/databind/ObjectMapper; @15: areturn Reason: Type 'com/fasterxml/jackson/dataformat/xml/XmlMapper' (current frame, stack[0]) is not assignable to 'com/fasterxml/jackson/databind/ObjectMapper' (from method signature) 

我尝试通过在glassfish-web.xml中设置元素在本地禁用类加载层次结构,以及全局设置系统属性fish.payara.classloading.delegate在domain.xml

我还尝试按照文档中的建议将以下内容添加到web.xml中,以及DispatcherServlet的init参数,但似乎没有帮助-

<context-param>
<param-name>jersey.config.jsonFeature</param-name>
<param-value>JacksonFeature</param-value>
</context-param> 

尝试通过在glassfish-web.xml中设置element来禁用本地的类加载层次结构。看起来Payara忽略了这个标志,并继续加载 Payara -5.2021.5payara5glassfishmodules中的库,而不是从应用程序加载。我甚至尝试用payara-web.xml替换glassfish-web.xml

通过在domain.xml中设置系统属性fish.payara.classloading.delegate为false解决了这个问题。

最新更新