问题
I have a spring boot application that execute a reverse Swagger
Yaml
:
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>generate-swagger-java</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${basedir}/src/main/resources/swagger/cview.yaml</inputSpec>
<apiPackage>client.api</apiPackage>
<modelPackage>client.model</modelPackage>
<output>${project.build.directory}/generated-sources</output>
<language>java</language>
<configOptions>
<dateLibrary>java8</dateLibrary>
<library>jersey2</library>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Running with a main class, it works well
public static void main(final String[] args) {
SpringApplication.run(SpringBootApp.class, args);
}
But when I run it with SpringBootServletInitializer
on WebSphere libertyCore
it stucks and gives me those errors when I try to call a web service :
org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "id_entite" (Class client.model.GaEj), not marked as ignorable
Problem with reading the data, class client.model.SearchResultGaEj, ContentType: application/json;charset=UTF-8
the problem is that i dont have any dependency with org.codehaus.jackson.*
I only use com.fasterxml.jackson.datatype
回答1:
By default, WebSphere
uses Codehaus Jackson
(reference). WebSphere
uses two Class-loader modes: Parent first
and Parent last
. You need to be sure that application uses Jackson
from FasterXML not from Codehause
. Spring Boot
does not have any own managed libraries but WebSphere
is an Application Server
which provides many already attached libraries so you do not need to provide them with your app.
See:
- Catch JsonProcessingException from Jackson in Websphere Liberty
- Change Default JSON Provider on WebSphere Application Server
- Override Jackson Object Mapper properties on Websphere 8.5.5 using Apache Wink
- How to change Jackson version in JAX-RS app (WebSphere Liberty)
来源:https://stackoverflow.com/questions/54668902/spring-boot-org-codehaus-jackson-map-exc-unrecognizedpropertyexception-unreco