【问题标题】:Spring MVC Jackson Exception on Payara 5 startupPayara 5启动时出现Spring MVC Jackson异常
【发布时间】:2021-07-27 15:23:02
【问题描述】:

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


Payara 5.2021.5 使用 Jackson 版本 2.10.2,而应用程序使用 Jackson 版本: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 中设置元素以及通过在 domain.xml 中将系统属性 fish.payara.classloading.delegate 设置为 false 来在本地禁用类加载层次结构

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

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

【问题讨论】:

    标签: spring spring-mvc payara


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2015-06-09
      • 2020-07-16
      • 1970-01-01
      • 2018-03-05
      • 1970-01-01
      • 2014-03-07
      • 1970-01-01
      • 1970-01-01
      • 2018-11-22
      相关资源
      最近更新 更多