java - Read file from sFtp server -


i'm reading file sftp server , load file database using spring batch framework below code m getting error

code:

<bean id="cvsfileitemreadermeta" class="org.springframework.batch.item.file.flatfileitemreader">     <!-- read csv file -->      <property name="resource" value= "ftp://scmuser:scmuser%40123@172.18.228.32:22/home/scmuser/csv/meta.csv" /> 

error:

org.springframework.batch.item.itemstreamexception: failed initialize reader     @ org.springframework.batch.item.support.abstractitemcountingitemstreamitemreader.open(abstractitemcountingitemstreamitemreader.java:142)     @ org.springframework.batch.item.support.compositeitemstream.open(compositeitemstream.java:96)     @ org.springframework.batch.core.step.item.chunkmonitor.open(chunkmonitor.java:115)     @ org.springframework.batch.item.support.compositeitemstream.open(compositeitemstream.java:96)     @ org.springframework.batch.core.step.tasklet.taskletstep.open(taskletstep.java:306)     @ org.springframework.batch.core.step.abstractstep.execute(abstractstep.java:192)     @ org.springframework.batch.core.job.simplestephandler.handlestep(simplestephandler.java:137)     @ org.springframework.batch.core.job.flow.jobflowexecutor.executestep(jobflowexecutor.java:64)     @ org.springframework.batch.core.job.flow.support.state.stepstate.handle(stepstate.java:60)     @ org.springframework.batch.core.job.flow.support.simpleflow.resume(simpleflow.java:152)     @ org.springframework.batch.core.job.flow.support.simpleflow.start(simpleflow.java:131)     @ org.springframework.batch.core.job.flow.flowjob.doexecute(flowjob.java:135)     @ org.springframework.batch.core.job.abstractjob.execute(abstractjob.java:301)     @ org.springframework.batch.core.launch.support.simplejoblauncher$1.run(simplejoblauncher.java:134)     @ org.springframework.core.task.synctaskexecutor.execute(synctaskexecutor.java:49)     @ org.springframework.batch.core.launch.support.simplejoblauncher.run(simplejoblauncher.java:127)     @ com.tcs.ceg.iforesee.service.dataloader.loadmetamapping(dataloader.java:127)     @ com.tcs.ceg.iforesee.service.uploadfile.uploadfile(uploadfile.java:77)     @ com.tcs.ceg.iforesee.service.uploadfile.main(uploadfile.java:22) caused by: java.lang.illegalstateexception: input resource must exist (reader in 'strict' mode): url [ftp://username:password@hostname.com:22/home/scmuser/csv/meta.csv]     @ org.springframework.batch.item.file.flatfileitemreader.doopen(flatfileitemreader.java:251)     @ org.springframework.batch.item.support.abstractitemcountingitemstreamitemreader.open(abstractitemcountingitemstreamitemreader.java:139) 

caused by: java.lang.illegalstateexception: input resource must exist (reader in 'strict' mode): url [ftp://username:password@hostname.com:22/home/scmuser/csv/meta.csv]

obviously resource not exist. either have ensure resource exists before attempting open or unset reader's strict mode using flatfileitemreader#setstrict , passing false

in strict mode reader throw exception on abstractitemcountingitemstreamitemreader.open(org.springframework.batch.item.executioncontext) if input resource not exist.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -