2013-10-03 145 views
2

我得到錯誤在Title中使用ClassifierCompositItemWriter使用以下作業配置文件中聲明。爲什麼沒有找到BackToBackPatternClassifier?我真的很陌生。如何解決java.lang.ClassNotFoundException:org.springframework.batch.classify.BackToBackPatternClassifier

我使用 - 春天核心版本3.2.2.RELEASE - Spring Batch的版本2.2.0.RELEASE

<bean id="domain" class="com.my.OneData" /> 

<job id="readAsString" xmlns="http://www.springframework.org/schema/batch"> 
    <step id="step1"> 
     <tasklet> 
      <chunk reader="theItemReader" writer="compositeWriter" 
       commit-interval="1" /> 
     </tasklet> 
    </step> 
</job> 

<bean id="theItemReader" class="org.springframework.batch.item.file.FlatFileItemReader"> 
    <property name="resource" value="file:csv/inputs/ad_usage_sample.csv" /> 
    <property name="linesToSkip" value="1"></property> 
    <property name="lineMapper"> 
     <bean 
      class="org.springframework.batch.item.file.mapping.PassThroughLineMapper"> 
     </bean> 
    </property> 
</bean> 

<bean id="compositeWriter" 
    class="org.springframework.batch.item.support.ClassifierCompositeItemWriter"> 
    <property name="classifier"> 
     <bean 
      class="org.springframework.batch.classify.BackToBackPatternClassifier"> 
      <property name="routerDelegate"> 
       <bean class="com.my.LineClassifier" /> 
      </property> 
      <property name="matcherMap"> 
       <map> 
        <entry key="abc" value-ref="fileItemWriter1" /> 
        <entry key="xyz" value-ref="fileItemWriter2" /> 
       </map> 
      </property> 
     </bean> 
    </property> 
</bean> 

<bean id="fileItemWriter1" class="org.springframework.batch.item.file.FlatFileItemWriter"> 
    <property name="resource" value="file:csv/outputs/oneLouderOutput3.csv" /> 
    <property name="appendAllowed" value="true" /> 
    <property name="lineAggregator"> 
     <bean 
    class="org.springframework.batch.item.file.transform.DelimitedLineAggregator"> 
      <property name="delimiter" value="," /> 
     </bean> 
    </property> 
</bean> 

<bean id="fileItemWriter2" class="org.springframework.batch.item.file.FlatFileItemWriter"> 
    <property name="resource" value="file:csv/outputs/oneLouderOutput3.csv" /> 
    <property name="appendAllowed" value="true" /> 
    <property name="lineAggregator"> 
     <bean 
    class="org.springframework.batch.item.file.transform.DelimitedLineAggregator"> 
      <property name="delimiter" value="," /> 
     </bean> 
    </property> 
</bean> 

回答

1

BackToBackPatternClassifier(和Classifier)是定義爲spring-retry模塊,並且可能需要將其jar包含在classpath中(我現在無法檢查,但最新版本是spring-retry-1.0.2.RELEASE

3

我只是有一個類似的問題,我發現我不得不把分類的包從

org.springframework.batch.classify.BackToBackPatternClassifier 

改變

org.springframework.classify.BackToBackPatternClassifier 

即刪除一批

我也是使用spring-retry-1.0.3.RELEASE.jar

+0

這應該修復它。這裏是春天重試依賴 \t org.springframework.retry \t 彈簧重試 \t 1.0.3.RELEASE sandeep