【问题标题】:Spring batch 2.4.1 + Wildfly 20 final - java.lang.NoSuchFieldError: BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPESSpring batch 2.4.1 + Wildfly 20 final - java.lang.NoSuchFieldError: BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES
【发布时间】:2021-04-12 21:59:04
【问题描述】:

我试图在 Wildfly server 20 final 上执行 Spring 批处理应用程序,但出现以下错误,

如果我使用内置的 tomcat 服务器,相同的代码可以正常工作。

Caused by: java.lang.NoSuchFieldError: BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES
    at org.springframework.batch.core.repository.dao.Jackson2ExecutionContextStringSerializer.<init>(Jackson2ExecutionContextStringSerializer.java:119)
    at org.springframework.batch.core.repository.support.JobRepositoryFactoryBean.afterPropertiesSet(JobRepositoryFactoryBean.java:192)
    at org.springframework.boot.autoconfigure.batch.BasicBatchConfigurer.createJobRepository(BasicBatchConfigurer.java:133)
    at org.springframework.boot.autoconfigure.batch.BasicBatchConfigurer.initialize(BasicBatchConfigurer.java:101)
    at org.springframework.boot.autoconfigure.batch.BasicBatchConfigurer.afterPropertiesSet(BasicBatchConfigurer.java:95)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1847)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1784)

【问题讨论】:

    标签: java spring-batch


    【解决方案1】:

    我也遇到了这个问题,看来 springbatch 4.3.0 引入了对 jackson databind 2.11 的依赖。

    这是春季提交:https://github.com/spring-projects/spring-batch/commit/9a79b4572d0aa4bec38fe90957c850920b7f9cea

    和数据绑定提交: https://github.com/FasterXML/jackson-databind/commit/fa402574f99daa10410682160365df0867abe4d4

    -> 所以需要降级到4.2.x或者升级jackson到2.11

    (更新:在 springbatch 4.3.0 中引入了 Commit,而不是 4.3.1)

    【讨论】:

    • 你是最棒的!我能够使用 Spring Boot Starters 2.2.0,但 spring-batch-core 只有 4.2.0.RELEASE,我想要 4.2.3.RELEASE,但同样的 NoSuchFieldError 失败了(spring 2.2.0 使用 jackson-数据绑定 2.10.0)。 2.11.0 搞定了,谢谢!
    猜你喜欢
    • 1970-01-01
    • 2020-12-03
    • 1970-01-01
    • 2015-12-03
    • 2018-09-28
    • 2017-01-03
    • 1970-01-01
    • 1970-01-01
    • 2015-04-25
    相关资源
    最近更新 更多