0

Hellow, I am trying execute the example posted in comment of the follow post.

I`m accessing the bucket and reading a list of file, but when I go execute the reader I receive the follow error message: "Caused by: java.lang.IllegalStateException: Input resource must exist (reader is in 'strict' mode): ServletContext resource [/s3://bkt-csv-files/files/23-12-2022/arquivo_jan_2022_pt_00]". How can I resolved this error, or, there is another way to read the files on s3 using spring-batch?

1 Answers1

0

I did not try the example you shared, but I would do it differently.

The FlatFileItemReader works with any implementation of the Resource interface. So if you manage to get an accessible resource in S3, you can use it with your item reader.

For example, you can use a URLResource that points to your file in S3 and set it on the item reader.

This might help as well: Spring Batch - Read files from Aws S3

Mahmoud Ben Hassine
  • 28,519
  • 3
  • 32
  • 50