0

I have configured BeanIOFlatFileItemWriter like below and using spring batch 4.2.4

@Bean
    public BeanIOFlatFileItemWriter<Transaction> glWriter() {
        BeanIOFlatFileItemWriter<GLTransaction> writer = new BeanIOFlatFileItemWriter<>();
        writer .setStreamMapping(new ClassPathResource("mapping.xml"));
        writer .setStreamName("transactionStream");
        writer .setResource(new FileSystemResource("out.csv"));
        return writer ;
    }

It fails with error java.lang.NoSuchMethodError: org.springframework.batch.support.transaction.TransactionAwareBufferedWriter.<init>(Ljava/io/Writer;Ljava/lang/Runnable;)V at org.beanio.spring.BeanIOFlatFileItemWriter$Stream.createBufferedWriter(BeanIOFlatFileItemWriter.java:561) at org.beanio.spring.BeanIOFlatFileItemWriter$Stream.open(BeanIOFlatFileItemWriter.java:372) at org.beanio.spring.BeanIOFlatFileItemWriter.open(BeanIOFlatFileItemWriter.java:101). Any help

nanpakal
  • 971
  • 3
  • 18
  • 37
  • 1
    This is usually because of dependencies that come from different versions where the API expect some method signature (what you have above) but the implementation on the classpath doesn't match that signature – nicoschl Jun 15 '20 at 15:43
  • What is `BeanIOFlatFileItemWriter`? Can you share its code? – Mahmoud Ben Hassine Jun 15 '20 at 15:47
  • BeanIOFlatFileItemWriter is bean-io implementation of ItemWriter ,https://github.com/fubar-coder/beanio/blob/master/src/org/beanio/spring/BeanIOFlatFileItemWriter.java – nanpakal Jun 15 '20 at 15:52
  • looks like Bean-io project is not active and not compatible with spring 4. https://github.com/kevinseim/beanio/issues/22 – nanpakal Jun 15 '20 at 16:04
  • 1
    ok that's a beanio issue then. Try with the latest Spring Batch 3.0.10 and see if it works. However, Spring Batch 3 is in EOL since January 11th, 2019: https://spring.io/blog/2019/01/11/spring-batch-4-1-1-4-0-2-and-3-0-10-available-now. – Mahmoud Ben Hassine Jun 15 '20 at 16:10

0 Answers0