1

I need to add a Spring Batch Job in my Spring Boot application, i need to downloads a list of file from a FTP and process them. They are CSV files.

I have created a Job with only one Step (i will come back later on this point).

In my step i have a Reader (FlatFileItemReader), a processor (that transform my entity) and an itemWriter that write the data in my Database.

I want to delete the file that i have downloaded after it's processing.

To dot that, i have tryied to add a second step that juste delete the file after the processsing. With that step2, some times my file is not deleted. It's like my ItemReader is not closing the inputStream so i keep an handler on it.

I have tried an other solution, use a custom FlatItemReader, i have override the close() method, to delete the file after is closed. A weird thing happen with this solution, my close method is called twice and some times i can delete the file and some times i can't delete it...

See the logs below :

o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] launched with the following parameters: [{time=1551704019790, PATH_TO_FILE=C:\tmp\tmpCorresp\ESPCORR_LITE2.CSV, organisationId=153}]
o.s.batch.core.job.SimpleStepHandler     : Executing step: [step1]
c.m.b.a.config.BatchConfig               : Do Close Started !!!!
c.m.b.a.config.BatchConfig               : start Deletion
c.m.b.a.config.BatchConfig               : File is not deleted
c.m.b.a.config.BatchConfig               : Do Close Started !!!!
c.m.b.a.config.BatchConfig               : start Deletion
c.m.b.a.config.BatchConfig               : File is not deleted
o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] completed with the following parameters: [{time=1551704019790, PATH_TO_FILE=C:\tmp\tmpCorresp\ESPCORR_LITE2.CSV, organisationId=153}] and the following status: [COMPLETED]
c.m.b.a.scheduled.TestTask               : FTP FILES FOR organisation2 DOWNLOADED
c.m.b.a.scheduled.TestTask               : Et BIM le flux !

the code of my close method :

@Override
        public void close() throws ItemStreamException {
            super.close();
            deleteFileAfterClose();
        }

        private void deleteFileAfterClose(){
            log.debug("start Deletion");
            File f = null;
            try {
                f = resourceHandler.getFile();
            } catch (IOException e) {
                log.error("Error while retrieving file : ", e);
            }
            if(f != null && f.exists()){
                boolean delete = f.delete();
                if(delete){
                    log.debug("File is deleted");
                }
                else {
                    log.debug("File is not deleted");
                }
            }
        }

I really thankfull if someone can help me.

Thanks !!!

Sincerely.

Nicolas Sagon.

edit :

My BatchConfig.java :

@Configuration
@PropertySource("classpath:config/default.properties")
@EnableBatchProcessing
public class BatchConfig {

    private static final Logger log = LoggerFactory.getLogger(BatchConfig.class);

    @Autowired
    public JobBuilderFactory jobBuilderFactory;

    @Autowired
    public StepBuilderFactory stepBuilderFactory;

    @Autowired
    public CorrespondentDao correspondentDao;

    @Autowired
    public JobRepository jobRepository;

    @Bean
    public SimpleJobLauncher simpleJobLauncher() throws Exception {
        SimpleJobLauncher simpleJobLauncher = new SimpleJobLauncher();
        simpleJobLauncher.setJobRepository(jobRepository);
        simpleJobLauncher.setTaskExecutor(new SyncTaskExecutor());
        simpleJobLauncher.afterPropertiesSet();
        return simpleJobLauncher;
    }

    @Bean
    public Job job(Step step1, Step step2) {
        return jobBuilderFactory.get("job")
                .preventRestart()
                .start(step1)
                .next(step2)
                .build();
    }

    @Bean
    Step step1(FlatFileItemReader<CorrespondentEntity> reader, ItemWriter<CorrespondentEntity> writer) {
        return stepBuilderFactory
                .get("step1")
                .<CorrespondentEntity, CorrespondentEntity>chunk(1)
                .reader(reader)
                .processor(new Processor())
                .writer(writer)
                .build();
    }

    //step for deleting the file
    @Bean
    Step step2(FileDeletingTasklet deletingTask) {
        FileDeletingTasklet task = deletingTask;
        return stepBuilderFactory.get("step2")
                .allowStartIfComplete(true)
                .tasklet(task)
                .build();
    }

    @SuppressWarnings("Duplicates")
    @Bean
    @JobScope
    public FlatFileItemReader<CorrespondentEntity> reader(@Value("#{jobParameters['PATH_TO_FILE']}") String pathToFile ) throws MalformedURLException {
        FlatFileItemReader<CorrespondentEntity> reader = new CustomReader<>();

        reader.setResource(new FileUrlResource(pathToFile));
        reader.setLinesToSkip(1);
        reader.setLineMapper(new csvLineMapper());
        return reader;
    }

    @Bean
    @JobScope
    public ItemWriter<CorrespondentEntity> writer(CorrespondentDao correspondentDao, @Value("#{jobParameters['organisationId']}") Long organisationId){
        return new Writer(correspondentDao, organisationId);
    }

    @Bean
    @JobScope
    public FileDeletingTasklet deletingTask(@Value("#{jobParameters['PATH_TO_FILE']}") String pathToFile){
        return new FileDeletingTasklet(pathToFile);
    }

    private class CustomReader<T> extends FlatFileItemReader<T> implements ItemStream {

        private Resource resourceHandler;

        @Override
        public void setResource(Resource resource) {
            super.setResource(resource);
            this.resourceHandler = resource;
        }

        @Override
        public void close() throws ItemStreamException {
            super.close();
        }

        //Not used for the moment
        private void deleteFileAfterClose(){
            log.debug("start Deletion");
            File f = null;
            try {
                f = resourceHandler.getFile();
            } catch (IOException e) {
                log.error("Error while retrieving file : ", e);
            }
            if(f != null && f.exists()){
                boolean delete = f.delete();
                if(delete){
                    log.debug("File is deleted");
                }
                else {
                    log.debug("File is not deleted");
                }
            }
        }
    }
}

FileDeletingTasklet.java

import com.micropole.biomnis.authentification.scheduled.TestTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;

import java.io.File;

public class FileDeletingTasklet implements Tasklet {


    private static final Logger log = LoggerFactory.getLogger(TestTask.class);
    private String filePath;

    public FileDeletingTasklet(String filePath) {
        this.filePath = filePath;
    }

    public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
        log.debug("try to delete this file : " + filePath);
        File f = new File(filePath);
        if(f.exists()){
            boolean delete = f.delete();
            if(delete){
                log.debug("File is deleted !!!!");
                return RepeatStatus.FINISHED;
            }
            else {
                log.debug("File is not deleted !!!");
                return RepeatStatus.FINISHED;
            }
        }
        return RepeatStatus.FINISHED;
    }

}
Sagon nicolas
  • 198
  • 3
  • 23

3 Answers3

1

Another approch to achieve your goal is to create a 3 steps job:

  1. Download file to local
  2. Process file
  3. Delete file

Every step do a specific action and may help you to manage flow exceptions in a better way.

Luca Basso Ricci
  • 17,829
  • 2
  • 47
  • 69
  • To be more precise, i start a job when all my files are downloaded from the FTP. I iterate throu all my files and start a new instance of the job that need to process the file and delete it. My Joblauncher has a Synchronous task executor, with that i'm able to ensure that the second job is started after the first is done, i can see that on my logs. – Sagon nicolas Mar 04 '19 at 14:20
0

In order to debug this you might consider using the Files class which throws an exception.

Note that the Files class defines the delete method to throw an IOException when a file cannot be deleted. This is useful for error reporting and to diagnose why a file cannot be deleted.

Normally files cannot be deleted because there is an open file handle to the file. Could it be that the resourceHandler needs to close the file in order for it to be deleted?

bmat
  • 224
  • 3
  • 5
  • Hi thanks for your answer, When i use the Files class i have an exception that said something is using my file so it can't be deleted. My ressourceHandler is just a ref to the Ressource (that is private). I'm almost sure it's not my ressourceHandler that prevent the delete – Sagon nicolas Mar 04 '19 at 13:19
  • Maybe you could use the try-with-resources syntax everywhere you are reading from files : https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html to ensure that the file is closed.... if this does not solve the problem it might be an issue with your spring batch job configuration... e.g running in parallell? – bmat Mar 04 '19 at 13:32
  • I am using the default implementation of the ItemFileReader so i don't have to handle any kind of manipulation on the file or the stream. this is why i don't understand how an handler can be lock on the file after the close method is called ... – Sagon nicolas Mar 04 '19 at 14:23
  • According to the docs you still have to close the streams - https://docs.spring.io/spring-batch/trunk/reference/html/readersAndWriters.html `6.4 ItemStream` but it's hard to help anyfurther without a bit more code showing how the files are processed. – bmat Mar 04 '19 at 14:29
  • I have added more of my Java code. Thanks for the help – Sagon nicolas Mar 04 '19 at 15:26
  • Doesn't look like `CustomReader` is doing all that much at the moment. Try removing this and see if this resolves the issue ;-) – bmat Mar 04 '19 at 16:16
  • Hi, no there is nothing to do ^^, i have start my processing batch for 2 files. In the logs (edit 2), you can see that every things is going well for the first file, the program wait until the first job is finished to start the second one. And in the second one my file can't be deleted .... – Sagon nicolas Mar 05 '19 at 08:46
  • I suggest you try to solve this problem by the 'divide and conquer' method. Start eliminating code until it starts working. e.g remove steps in the batch job.. feks create a batch job to just delete all the files... if that works then enable the reader, then the processor then the writer. Eventually you will identify the cause. – bmat Mar 05 '19 at 10:56
0

I'm sorry i answer my own question, but i don't have enough characters on my original message to post my logs :

2019-03-05 09:38:31.219  INFO 22872 --- [nio-8080-exec-2] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] launched with the following parameters: [{time=1551775111110, PATH_TO_FILE=C:\tmp\tmpCorresp\ESPCORR_LITE.CSV, organisationId=152}]
2019-03-05 09:38:31.275  INFO 22872 --- [nio-8080-exec-2] o.s.batch.core.job.SimpleStepHandler     : Executing step: [step1]
2019-03-05 09:38:31.664  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@35bd22f7) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@5312191f)
====> TRUC
Déjà en  base de donnée
2019-03-05 09:38:31.708  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@32693a30) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@257865d5)
====> AD00
Déjà en  base de donnée
2019-03-05 09:38:31.757  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@65e1b8c2) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@1e22a6f4)
====> AD01
Déjà en  base de donnée
2019-03-05 09:38:31.773  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@4f666db2) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@44f877ac)
====> AD01FR01
Déjà en  base de donnée
2019-03-05 09:38:31.789  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@43ab7a49) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@47c8cf74)
====> AG001
Déjà en  base de donnée
2019-03-05 09:38:31.805  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@485ec65b) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@50bf942b)
====> AI00
Déjà en  base de donnée
2019-03-05 09:38:31.820  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@54caf8ac) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@6a989070)
====> AI01
Déjà en  base de donnée
2019-03-05 09:38:31.846  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@56f15894) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@3287ec32)
====> AI01_0102
Déjà en  base de donnée
2019-03-05 09:38:31.866  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@2008f8d1) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@7ce131bc)
====> AI01_0103
Déjà en  base de donnée
2019-03-05 09:38:31.916 DEBUG 22872 --- [nio-8080-exec-2] c.m.b.a.config.BatchConfig               : Stream closed
2019-03-05 09:38:31.943  INFO 22872 --- [nio-8080-exec-2] o.s.batch.core.job.SimpleStepHandler     : Executing step: [step2]
2019-03-05 09:38:31.965 DEBUG 22872 --- [nio-8080-exec-2] c.m.b.a.scheduled.TestTask               : try to delete this file : C:\tmp\tmpCorresp\ESPCORR_LITE.CSV
2019-03-05 09:38:31.966 DEBUG 22872 --- [nio-8080-exec-2] c.m.b.a.scheduled.TestTask               : File is deleted
2019-03-05 09:38:32.013  INFO 22872 --- [nio-8080-exec-2] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] completed with the following parameters: [{time=1551775111110, PATH_TO_FILE=C:\tmp\tmpCorresp\ESPCORR_LITE.CSV, organisationId=152}] and the following status: [COMPLETED]
2019-03-05 09:38:32.014  INFO 22872 --- [nio-8080-exec-2] c.m.b.a.scheduled.TestTask               : FTP FILES FOR organisation1 DOWNLOADED
220-FileZilla Server version 0.9.49 beta
220-written by Tim Kosse (tim.kosse@filezilla-project.org)
220 Please visit https://filezilla-project.org/
USER micropole
331 Password required for micropole
PASS micropole
230 Logged on
SYST
215 UNIX emulated by FileZilla
PORT 172,16,31,55,217,123
200 Port command successful
LIST /organisation2/correspondants/*.csv
150 Opening data channel for directory listing of "/organisation2/correspondants/*.csv"
226 Successfully transferred "/organisation2/correspondants/*.csv"
PORT 172,16,31,55,217,124
200 Port command successful
RETR /organisation2/correspondants/ESPCORR_LITE2.CSV
150 Opening data channel for file download from server of "/organisation2/correspondants/ESPCORR_LITE2.CSV"
226 Successfully transferred "/organisation2/correspondants/ESPCORR_LITE2.CSV"
2019-03-05 09:38:32.132  INFO 22872 --- [nio-8080-exec-2] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] launched with the following parameters: [{time=1551775112081, PATH_TO_FILE=C:\tmp\tmpCorresp\ESPCORR_LITE2.CSV, organisationId=153}]
2019-03-05 09:38:32.164  INFO 22872 --- [nio-8080-exec-2] o.s.batch.core.job.SimpleStepHandler     : Executing step: [step1]
2019-03-05 09:38:32.174  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@17e8cdfb) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@17097d5b)
====> TRUC
Déjà en  base de donnée
2019-03-05 09:38:32.185  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@7fc14dfa) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@64a18d83)
====> PC##INCE
Déjà en  base de donnée
2019-03-05 09:38:32.196  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@42156d18) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@37ce463d)
====> PCAD00
Déjà en  base de donnée
2019-03-05 09:38:32.205  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@301161b0) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@5905b707)
====> PCAD01
Déjà en  base de donnée
2019-03-05 09:38:32.215  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@1b954b79) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@2032b55a)
====> PCAD01FR01
Déjà en  base de donnée
2019-03-05 09:38:32.232  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@33183058) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@3b7560dc)
====> PCAG001
Déjà en  base de donnée
2019-03-05 09:38:32.250  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@18345852) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@153bad07)
====> PCAI00
Déjà en  base de donnée
2019-03-05 09:38:32.269  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@3418d088) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@6af05e2a)
====> PCAI01
Déjà en  base de donnée
2019-03-05 09:38:32.281  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@315509a6) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@43bb1394)
====> PCAI01_0102
Déjà en  base de donnée
2019-03-05 09:38:32.293  INFO 22872 --- [nio-8080-exec-2] c.m.b.authentification.step.Processor    : Converting (com.micropole.biomnis.authentification.model.CorrespondentEntity@ea79422) into (com.micropole.biomnis.authentification.model.CorrespondentEntity@17a6b469)
====> PCAI01_0103
Déjà en  base de donnée
2019-03-05 09:38:32.334 DEBUG 22872 --- [nio-8080-exec-2] c.m.b.a.config.BatchConfig               : Stream closed
2019-03-05 09:38:32.358  INFO 22872 --- [nio-8080-exec-2] o.s.batch.core.job.SimpleStepHandler     : Executing step: [step2]
2019-03-05 09:38:32.383 DEBUG 22872 --- [nio-8080-exec-2] c.m.b.a.scheduled.TestTask               : try to delete this file : C:\tmp\tmpCorresp\ESPCORR_LITE2.CSV
2019-03-05 09:38:32.385 ERROR 22872 --- [nio-8080-exec-2] c.m.b.a.scheduled.TestTask               : File is not :( QQ

java.nio.file.FileSystemException: C:\tmp\tmpCorresp\ESPCORR_LITE2.CSV: Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus.

    at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86) ~[na:1.8.0_172]
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) ~[na:1.8.0_172]
    at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) ~[na:1.8.0_172]
    at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269) ~[na:1.8.0_172]
    at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103) ~[na:1.8.0_172]
    at java.nio.file.Files.delete(Files.java:1126) ~[na:1.8.0_172]
    at com.micropole.biomnis.authentification.step.FileDeletingTasklet.execute(FileDeletingTasklet.java:28) ~[classes/:na]
    at com.micropole.biomnis.authentification.step.FileDeletingTasklet$$FastClassBySpringCGLIB$$21e4f0e9.invoke(<generated>) [classes/:na]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) [spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746) [spring-aop-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:136) [spring-aop-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) [spring-aop-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring-aop-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) [spring-aop-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at com.micropole.biomnis.authentification.step.FileDeletingTasklet$$EnhancerBySpringCGLIB$$b769dcc5.execute(<generated>) [classes/:na]
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) [spring-tx-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:272) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:375) [spring-batch-infrastructure-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215) [spring-batch-infrastructure-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:145) [spring-batch-infrastructure-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:200) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:394) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.core.job.SimpleJob.doExecute(SimpleJob.java:135) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:308) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:141) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50) [spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:134) [spring-batch-core-4.0.1.RELEASE.jar:4.0.1.RELEASE]
    at com.micropole.biomnis.authentification.scheduled.RunFlux.startWriteDatabase(RunFlux.java:100) [classes/:na]
    at com.micropole.biomnis.authentification.scheduled.RunFlux.importCorresp(RunFlux.java:71) [classes/:na]
    at com.micropole.biomnis.authentification.scheduled.RunFlux.runCorrespFlux(RunFlux.java:51) [classes/:na]
    at com.micropole.biomnis.authentification.service.FluxServiceImpl.flux(FluxServiceImpl.java:24) [classes/:na]
    at com.micropole.biomnis.authentification.controller.WebServiceController.postStartFlux(WebServiceController.java:51) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_172]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_172]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_172]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_172]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) [spring-security-web-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_172]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_172]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.34.jar:8.5.34]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_172]

2019-03-05 09:38:32.432  INFO 22872 --- [nio-8080-exec-2] o.s.b.c.l.support.SimpleJobLauncher      : Job: [SimpleJob: [name=job]] completed with the following parameters: [{time=1551775112081, PATH_TO_FILE=C:\tmp\tmpCorresp\ESPCORR_LITE2.CSV, organisationId=153}] and the following status: [COMPLETED]
2019-03-05 09:38:32.432  INFO 22872 --- [nio-8080-exec-2] c.m.b.a.scheduled.TestTask               : FTP FILES FOR organisation2 DOWNLOADED
2019-03-05 09:38:32.432  INFO 22872 --- [nio-8080-exec-2] c.m.b.a.scheduled.TestTask               : Et BIM le flux !
Sagon nicolas
  • 198
  • 3
  • 23