我的示例Spring Batch项目的step2()下面的方法在一台PC上运行正常,而在另一台PC上抛出以下错误。

有人可以解释我的代码有什么问题吗?


Error: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'step2' defined in class path resource
[com/xxxx/yyy/configuration/CustomJobConfiguration.class]: Bean
instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [org.springframework.batch.core.Step]: Factory method
'step2' threw exception; nested exception is
java.lang.NoClassDefFoundError:
org/springframework/classify/Classifier



方法:

@Bean
public Step step2() {
    System.out.println("Entering step2()");

    return stepBuilderFactory.get("step2")
            .<String, String>chunk(Integer.valueOf(chunkSize))
            .faultTolerant()
            .reader(reader())
            .writer(writer())
            .build();
}

最佳答案

您缺少spring-retry类的Classifier依赖项jar


  Spring Retry提供了有关重试失败操作的抽象

10-02 09:15