Issue
My application is using the following:
JDK version: Open JDK
jdk-11.0.11+9
Payara : 5.2021.5
Spring version: 5.2.7.RELEASE
jackson version: 2.9.4.
Payara 5.2021.5 uses Jackson version 2.10.2, whereas the application uses Jackson version: 2.9.4. It looks like the method signature for some Jackson methods used by SpringMVC has changed in Jackson 2.10.2.
On Server startup, the following Exception is thrown:
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)
I tried disabling class loading hierarchy locally by setting element in the glassfish-web.xml as well as globally, by setting system property fish.payara.classloading.delegate to false in domain.xml
I also tried adding the following to web.xml as suggested in documentation, as well as the init parameter to DispatcherServlet, but does not seem to help-
<context-param>
<param-name>jersey.config.jsonFeature</param-name>
<param-value>JacksonFeature</param-value>
</context-param>
Solution
tried disabling class loading hierarchy locally by setting element in the glassfish-web.xml. It looks like Payara ignores this flag and continues to load the libraries in \payara-5.2021.5\payara5\glassfish\modules, instead of loading from the application. I even tried by replacing glassfish-web.xml with payara-web.xml
The issue resolved by setting system property fish.payara.classloading.delegate to false in domain.xml.
Answered By - kk_atl
Answer Checked By - Marie Seifert (JavaFixing Admin)