Pro-Spring-Batch-source-code
Pro-Spring-Batch-source-code copied to clipboard
Do you know - how to run the statement-job?
Is there any driver class or some clues you can provide to run it as a stand-alone java application? I made it compile but not finding a way to execute it.... if i do mvn clean install(with run -configuration fix)...i am getting a JAR...but can't execute the JAR. How to run it - execute it? Do you have some more steps/write-up to make it run? Please help me. I am setting up the MySQL DB for it's execution.
When you attempt to run the jar file via java -jar the jar name, what exception or output do you get?
I was getting class not found or Main method not found kind of errors...i have moved ahead of that...created a driver class and tried running...just missing the .csv file at the right place..once i have it...i think i will be able to run it.
error: Caused by: java.lang.IllegalStateException: Input resource must exist (reader is in 'strict' mode): file [C:\Users\mminella\temp\test.csv] at org.springframework.batch.item.file.FlatFileItemReader.doOpen(FlatFileItemReader.java:250) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:134)
On Thu, Apr 16, 2015 at 2:49 PM, Michael Minella [email protected] wrote:
When you attempt to run the jar file via java -jar the jar name, what exception or output do you get?
— Reply to this email directly or view it on GitHub https://github.com/mminella/Pro-Spring-Batch-source-code/issues/3#issuecomment-93825025 .
With best Regards: Ashutosh Sharma
2015-04-16 15:07:04,874 INFO main [org.springframework.context.support.ClassPathXmlApplicationContext] - <Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@45fe3ee3: startup date [Thu Apr 16 15:07:04 CDT 2015]; root of context hierarchy> 2015-04-16 15:07:04,919 INFO main [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from class path resource [jobs/statementJob.xml]> 2015-04-16 15:07:05,027 INFO main [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from class path resource [launch-context.xml]> 2015-04-16 15:07:05,088 INFO main [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Overriding bean definition for bean 'statementJob': replacing [Generic bean: class [org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.batch.core.configuration.xml.JobParserJobFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]> 2015-04-16 15:07:05,170 INFO main [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] - <Loading properties file from class path resource [batch.properties]> 2015-04-16 15:07:05,181 INFO main [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Overriding bean definition for bean 'transactionPricingItemReader': replacing [Generic bean: class [org.springframework.batch.item.database.JdbcCursorItemReader]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [jobs/statementJob.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in class path resource [jobs/statementJob.xml]]> 2015-04-16 15:07:05,181 INFO main [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Overriding bean definition for bean 'stagingStepListener': replacing [Generic bean: class [com.apress.springbatch.statement.listener.StagingStepListener]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [jobs/statementJob.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in class path resource [jobs/statementJob.xml]]> 2015-04-16 15:07:05,181 INFO main [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Overriding bean definition for bean 'stagingChunkUpdater': replacing [Generic bean: class [com.apress.springbatch.statement.listener.StagingChunkUpdater]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [jobs/statementJob.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in class path resource [jobs/statementJob.xml]]> 2015-04-16 15:07:05,196 INFO main [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@32d992b2: defining beans [jobExplorer,jobLauncher,jobRepository,dataSource,transactionManager,placeholderProperties,idIncrementer,customerTransactionFile,customerFieldSetMapper,transactionFieldSetMapper,customerTransactionLineMapper,customerLineTokenizer,transactionLineTokenizer,customerTransactionReader,customerLookupItemProcessor,customerDao,tickerDao,accountDao,customerImportWriter,transactionImportWriter,customerTransactionItemWriter,stockPriceWebServiceReader,stockFile,stockFileWriter,stockFileReader,stock,tickerUpdateWriter,accountTransactionQtyItemReader,accountTransactionQtyRowMapper,pricingTiersItemProcessor,tiersUpdateWriter,transactionPricingItemReader,transactionPricingRowMapper,feesItemProcessor,feesUpdateWriter,cashBalanceUpdateWriter,applyFeeWriter,customerReader,customerStatementRowMapper,customerStatementReader,statementFiles,statementSuffixGenerator,statementFormatter,statementWriter,statementsWriter,org.springframework.batch.core.scope.internalStepScope,org.springframework.beans.factory.config.CustomEditorConfigurer,org.springframework.batch.core.configuration.xml.CoreNamespacePostProcessor,importCustomerAndTransactionData,retrieveStockPrices,importStockPrices,calculateTiers,calculateTransactionFees,stagingStepListener,stagingChunkUpdater,taskExecutor,generateMonthlyStatements,step1,step2,step3,step4,step5,step6,statementJob,scopedTarget.transactionPricingItemReader,scopedTarget.stagingStepListener,scopedTarget.stagingChunkUpdater]; root of factory hierarchy> 2015-04-16 15:07:05,422 INFO main [org.springframework.batch.core.repository.support.JobRepositoryFactoryBean] - <No database type set, using meta data indicating: MYSQL> 2015-04-16 15:07:05,504 INFO main [org.springframework.batch.core.launch.support.SimpleJobLauncher] - <No TaskExecutor has been set, defaulting to synchronous executor.> 2015-04-16 15:07:05,858 INFO main [org.springframework.batch.core.launch.support.SimpleJobLauncher] - <Job: [FlowJob: [name=statementJob]] launched with the following parameters: [{}]> 2015-04-16 15:07:05,859 DEBUG main [org.springframework.batch.core.job.AbstractJob] - <Job execution starting: JobExecution: id=2, version=0, startTime=null, endTime=null, lastUpdated=Thu Apr 16 15:07:05 CDT 2015, status=STARTING, exitStatus=exitCode=UNKNOWN;exitDescription=, job=[JobInstance: id=1, version=0, JobParameters=[{}], Job=[statementJob]]> 2015-04-16 15:07:05,927 DEBUG main [org.springframework.batch.core.job.flow.support.SimpleFlow] - <Resuming state=statementJob.step1 with status=UNKNOWN> 2015-04-16 15:07:05,927 DEBUG main [org.springframework.batch.core.job.flow.support.SimpleFlow] - <Handling state=statementJob.step1> 2015-04-16 15:07:06,001 INFO main [org.springframework.batch.core.job.SimpleStepHandler] - <Executing step: [step1]> 2015-04-16 15:07:06,002 DEBUG main [org.springframework.batch.core.step.AbstractStep] - <Executing: id=2> 2015-04-16 15:07:06,108 ERROR main [org.springframework.batch.core.step.AbstractStep] - <Encountered an error executing the step> org.springframework.batch.item.ItemStreamException: Failed to initialize the reader at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:137) at org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:93) at org.springframework.batch.core.step.tasklet.TaskletStep.open(TaskletStep.java:289) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:192) at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135) at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61) at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60) at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124) at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135) at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:281) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:114) at com.apress.springbatch.statement.driver.RunIt.run(RunIt.java:37) at com.apress.springbatch.statement.driver.RunIt.main(RunIt.java:22) Caused by: java.lang.IllegalStateException: Input resource must exist (reader is in 'strict' mode): file [C:\Users\mminella\temp\test.csv] at org.springframework.batch.item.file.FlatFileItemReader.doOpen(FlatFileItemReader.java:250) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:134) ... 15 more 2015-04-16 15:07:06,211 DEBUG main [org.springframework.batch.core.step.AbstractStep] - <Step execution complete: StepExecution: id=2, version=2, name=step1, status=FAILED, exitStatus=FAILED, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=0, rollbackCount=0> 2015-04-16 15:07:06,267 DEBUG main [org.springframework.batch.core.job.flow.support.SimpleFlow] - <Completed state=statementJob.step1 with status=FAILED> 2015-04-16 15:07:06,268 DEBUG main [org.springframework.batch.core.job.flow.support.SimpleFlow] - <Handling state=statementJob.fail0> 2015-04-16 15:07:06,268 DEBUG main [org.springframework.batch.core.job.flow.support.SimpleFlow] - <Completed state=statementJob.fail0 with status=FAILED> 2015-04-16 15:07:06,270 DEBUG main [org.springframework.batch.core.job.AbstractJob] - <Job execution complete: JobExecution: id=2, version=1, startTime=Thu Apr 16 15:07:05 CDT 2015, endTime=null, lastUpdated=Thu Apr 16 15:07:05 CDT 2015, status=FAILED, exitStatus=exitCode=FAILED;exitDescription=, job=[JobInstance: id=1, version=0, JobParameters=[{}], Job=[statementJob]]> 2015-04-16 15:07:06,300 INFO main [org.springframework.batch.core.launch.support.SimpleJobLauncher] - <Job: [FlowJob: [name=statementJob]] completed with the following parameters: [{}] and the following status: [FAILED]> Done