Results 1 to 3 of 3

Thread: Using MultiResourceItemReader with non existing files

  1. #1
    Join Date
    Dec 2007
    Location
    Zaragoza, Spain
    Posts
    17

    Default 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. #2
    Join Date
    Feb 2008
    Posts
    488

    Default

    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}*" />

  3. #3
    Join Date
    Dec 2007
    Location
    Zaragoza, Spain
    Posts
    17

    Default

    Thanks Dan.

    It was too much easy to be obvious...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •