2016-12-27 53 views
0

使用IBM的JRE 1.7開發Spring批處理作業時出現錯誤。Spring批處理3,IBM JVM上的配置加載錯誤(BackToBackPatternClassifier)

Spring Batch的版本是3.0.7,Spring版本是4.3.5

此誤差沒有與Oracle JDK 1.7的發生。 當我在作業開始之前加載我的Spring Batch XML Configuration,jobs-configuration.xml時,它顯示出來。 此問題出現後,我升級Spring Batch的和Spring:從Spring Batch的org.springframework.batch.classify.BackToBackPatternClassifier成爲org.springframework.classify.BackToBackPatternClassifier(春重試)

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) 

工作-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> 

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

} 

回答

1

這僅僅是一個包導入錯誤... 由於SpringBatch V3,分類器必須從封裝件的輸入:

  • org.springframework.classify.annotation.Classifier

代替前者(SpringBatch V2)

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

包改進後,everythin g工作正常!

Regards, 大。

相關問題