Spring启动:org.codehaus.jackson.map.exc.UnrecognizedPropertyException:WebSphere中无法识别的字段“XX”

问题描述 投票:0回答:1

我有一个弹簧启动应用程序执行反向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>

使用主类运行,效果很好

public static void main(final String[] args) {
 SpringApplication.run(SpringBootApp.class, args);
}

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

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

问题是我与qazxsw poi没有任何依赖关系

我只使用org.codehaus.jackson.*

java spring-boot jackson websphere-liberty
1个回答
0
投票

默认情况下,com.fasterxml.jackson.datatype使用WebSphereCodehaus Jackson)。 reference使用两个WebSphereClass-loader modesParent first。您需要确保该应用程序使用来自Parent lastJackson而不是FasterXMLCodehause没有任何自己的托管库,但Spring Boot是一个WebSphere,它提供了许多已经附加的库,因此您不需要为它们提供应用程序。

看到:

  1. Application Server
  2. Catch JsonProcessingException from Jackson in Websphere Liberty
  3. Change Default JSON Provider on WebSphere Application Server
  4. Override Jackson Object Mapper properties on Websphere 8.5.5 using Apache Wink
© www.soinside.com 2019 - 2024. All rights reserved.