春季启动:org.codehaus.jackson.map.exc.UnrecognizedPropertyException:无法识别的字段"XX"在WebSphere中 [英] Spring boot : org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "XX" in WebSphere

查看:144
本文介绍了春季启动:org.codehaus.jackson.map.exc.UnrecognizedPropertyException:无法识别的字段"XX"在WebSphere中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个执行反向Swagger Yaml的Spring Boot应用程序:

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);
}

但是当我在WebSphere libertyCore上用SpringBootServletInitializer运行它时,它卡住了,并在尝试调用Web服务时给了我这些错误:

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

问题是我对org.codehaus.jackson.*

我只使用com.fasterxml.jackson.datatype

推荐答案

默认情况下,WebSphere使用Codehaus Jackson(类加载器模式:Parent firstParent last.您需要确保应用程序使用来自 FasterXML 而非CodehauseJackson. Spring Boot没有任何自己的托管库,但是WebSphereApplication Server,它提供了许多已经连接的库,因此您无需在应用程序中提供它们.

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.

请参阅:

  1. 在Websphere中从Jackson捕获JsonProcessingException自由
  2. 更改WebSphere Application Server上的默认JSON提供程序
  3. 覆盖使用Apache Wink在Websphere 8.5.5上的Jackson Object Mapper属性
  4. 如何更改Jackson版本在JAX-RS应用程序(WebSphere Liberty)中
  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)

这篇关于春季启动:org.codehaus.jackson.map.exc.UnrecognizedPropertyException:无法识别的字段"XX"在WebSphere中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆