javaspringspring-batchspring-retryibm-jvm

Spring batch 3, error at configuration load on IBM JVM (BackToBackPatternClassifier)


I get an error when lauching a spring batch Job with IBM's JRE 1.7.

Spring Batch version is 3.0.7, Spring version is 4.3.5

This error is not happening with Oracle JDK 1.7. It appears when I load my Spring Batch XML Configuration, jobs-configuration.xml before a job is even starting. This problem appeared after I upgraded Spring Batch and Spring : org.springframework.batch.classify.BackToBackPatternClassifier from Spring Batch became org.springframework.classify.BackToBackPatternClassifier (in 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)

jobs-configuration.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>

And the ClassifierCcsb01Writer:

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

}

Solution

  • It is just a package import error ... Since SpringBatch V3, Classifier must be imported from package :

    instead of former (SpringBatch V2)

    After package import correction, everything is working fine !

    Regards, Big.