gpt4 book ai didi

java - Spring 批处理 3,IBM JVM (BackToBackPatternClassifier) 上的配置加载时出错

转载 作者:行者123 更新时间:2023-12-01 09:05:07 25 4
gpt4 key购买 nike

使用 IBM 的 JRE 1.7 启动 Spring Batch 作业时出现错误。

Spring Batch 版本为 3.0.7,Spring 版本为 4.3.5

Oracle JDK 1.7 不会发生此错误。当我在作业开始之前加载 Spring Batch XML 配置 jobs-configuration.xml 时,它就会出现。这个问题是在我升级Spring Batch和Spring后出现的:org.springframework.batch.classify.BackToBackPatternClassifier从Spring Batch变成了org.springframework.classify.BackToBackPatternClassifier(在Spring Retry中)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'classifierCcsb01Writer' defined in class path resource [com/bob/batch/spring/configuration/jobs-configuration.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'routerDelegate' threw exception; nested exception is java.lang.IllegalStateException: More than one non-void public method detected with single argument.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1523)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1231)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
... 26 more
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'routerDelegate' threw exception; nested exception is java.lang.IllegalStateException: More than one non-void public method detected with single argument.
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:121)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1519)

作业配置.xml:

<bean id="ItemWriter"
class="org.springframework.batch.item.support.ClassifierCompositeItemWriter">
<property name="classifier" ref="classifierCcsb01Writer" />
</bean>

<bean id="classifierCcsb01Writer"
class="org.springframework.classify.BackToBackPatternClassifier">
<property name="routerDelegate">
<bean
class="com.bob.batch.spring.writers.ClassifierCcsb01Writer" />
</property>
<property name="matcherMap">
<map>
<entry key="create" value-ref="ccsb01Writer" />
<entry key="ko" value-ref="ccsb01ErrorWriter" />
</map>
</property>
</bean>

和分类器Ccsb01Writer:

package com.bob.batch.spring.writers;

import org.springframework.batch.support.annotation.Classifier;

import com.bob.batch.spring.bean.RoutingBean;

public class ClassifierCcsb01Writer {

@Classifier
public String classify(RoutingBean routingBean) {
return routingBean.getType();
}

}

最佳答案

这只是一个包导入错误......从SpringBatch V3开始,必须从包中导入Classifier:

  • org.springframework.classify.annotation.Classifier

而不是以前的(SpringBatch V2)

  • org.springframework.batch.support.annotation.Classifier

包导入更正后,一切正常!

问候,大。

关于java - Spring 批处理 3,IBM JVM (BackToBackPatternClassifier) 上的配置加载时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41348179/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com