0

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

Michał Ziober
  • 37,175
  • 18
  • 99
  • 146
Mirlo
  • 625
  • 9
  • 26

1 Answers1

0

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:

  1. Catch JsonProcessingException from Jackson in Websphere Liberty
  2. Change Default JSON Provider on WebSphere Application Server
  3. Override Jackson Object Mapper properties on Websphere 8.5.5 using Apache Wink
  4. How to change Jackson version in JAX-RS app (WebSphere Liberty)
Michał Ziober
  • 37,175
  • 18
  • 99
  • 146
  • Ziober the question is : should i add or remove feature from my server.xml ? because on my machine works correctly, so when i deploy on WebSphere here the problem comes ! – Mirlo Feb 14 '19 at 13:56
  • On your machine you do not use `WebSphere`, you use `Spring Boot` with embedded web server: `Tomcat` or `Jetty`. On these two servers this problem does not appear. It appears on `WebSphere` because it contains inside much more than simple `HTTP` server. Have you read articles I referenced to? Right now I am not able to point exactly what you have to remove, I hoped you read these articles and dig into documentation and configuration by yourself. More or less this is a general problem with servers like `WebSphere` or `JBoss` for which we need to disable internal libs and change path order. – Michał Ziober Feb 14 '19 at 14:15
  • Take a look also on this [page](https://www.ibm.com/support/knowledgecenter/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/twlp_classloader_alt_api.html), it describes how to configure `ParentLast` `ClassLoader`. – Michał Ziober Feb 14 '19 at 14:28