Announcement Announcement Module
Collapse
No announcement yet.
Using MultiResourceItemReader with non existing files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using MultiResourceItemReader with non existing files

    Our batch process downloads several files from different servers and performs operations on it later.

    We're using MutiResourceItemReader in that way:
    Code:
    <beans:bean id="multifileWSReader" class="org.springframework.batch.item.file.MultiResourceItemReader" lazy-init="true">
        <beans:property name="resources" value="${loc.working.directory.webserver}/${webserver.file}*" />
        <beans:property name="delegate" ref="flatFileWSItemReader" />
    </beans:bean>
    When the batch is started, following error message is showed:
    Code:
    Caused by: java.lang.IllegalArgumentException: Could not resolve resource location pattern [D:/batch/data/webservers/trxmin_webserver.log*]: class path resource [D:/batch/data/webservers/] cannot be resolved to URL because it does not exist
    Directory D:/batch/data/webservers exists before the execution, but trxmin_webserver.log files are downloaded in a previous step of the batch process.

    Thanks!

  • #2
    Try prefixing the resource location with "file:" to indicate that the resource is a FileSystemResource instead of a ClasspathResource (which is probably your default).

    Code:
    <beans:property name="resources" value="file:${loc.working.directory.webserver}/${webserver.file}*" />

    Comment


    • #3
      Thanks Dan.

      It was too much easy to be obvious...

      Comment

      Working...
      X