![spring batch read from file and write to database from form spring batch read from file and write to database from form](http://websystique.com/wp-content/uploads/2014/08/SpringBatchXmlToDatabase_img1.png)
Hi i am the below error.can anyone tell me the solutionĥ:55:39 PM .AbstractApplicationContext prepareRefresh INFO: Job: ] completed with the following parameters: and the following status: ItemStreamException: Failed to initialize the readerĪt .(AbstractItemCountingItemStreamItemReader.java:142)Īt .(CompositeItemStream.java:96)Īt .(TaskletStep.java:306)Īt .(AbstractStep.java:192)Īt .(SimpleStepHandler.java:137)Īt .(JobFlowExecutor.java:64)Īt .StepState.handle(StepState.java:60)Īt .resume(SimpleFlow.java:152)Īt .start(SimpleFlow.java:131)Īt .(FlowJob.java:135)Īt .(AbstractJob.java:301)Īt .$1.run(SimpleJobLauncher.java:134)Īt .SyncTaskExecutor.execute(SyncTaskExecutor.java:49)Īt .(SimpleJobLauncher.java:127)Īt .main(Driver.java:25)Ĭaused by: : Input resource must exist (reader is in ‘strict’ mode): class path resource Īt .(FlatFileItemReader.java:251)Īt .(AbstractItemCountingItemStreamItemReader.java:139)ġ2:48:56 PM .$1 run SEVERE: Encountered an error executing the step The Spring Batch metadata tables are created, and the content of report.cvs is inserted into database table “ RAW_REPORT“.ġ2:48:56 PM .step.AbstractStep execute ("Exit Status : " + execution.getStatus())
![spring batch read from file and write to database from form spring batch read from file and write to database from form](https://i.ytimg.com/vi/wIuE__zR8wg/sddefault.jpg)
JobExecution execution = n(job, new JobParameters()) Job job = (Job) context.getBean("reportJob") JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher") New ClassPathXmlApplicationContext(springConfig) Resources/spring/batch/jobs/job-report.xml Btw, remember create the “ RAW_REPORT” table manually. Read the comment, it should be self-explanatory. This job-report.xml file define a job to read a report.csv file, match it to report plain pojo and write the data into MySQL database.
![spring batch read from file and write to database from form spring batch read from file and write to database from form](https://venturebeat.com/wp-content/uploads/2018/11/IMG_20181022_185834.jpg)
This is the main xml file to configure the Spring batch job. Resources/spring/batch/config/context.xml Resources/spring/batch/config/database.xml