java - 初始化读取器在 Spring 批处理中的一步失败

标签 java spring-batch

对不起,我不能提供很多关于受错误影响的批处理的信息。

当 XML 输入文件位于正确的存储库中时,我想大致了解在初始化阅读器时会导致错误的原因。 spring batch v1和spring batch v2在初始化普通简单步骤的reader进程时有什么变化吗?

几天前,我们进行了批量迁移到 Spring Batch V2。

ERROR 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:142) at org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:96) at org.springframework.batch.core.step.tasklet.TaskletStep.open(TaskletStep.java:306) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:192) at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:137) at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64) 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:152) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:131) at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135) at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:301) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:134) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:127) at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:351) at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:577) Caused by: java.lang.IllegalStateException: Input resource must exist (reader is in 'strict' mode) at org.springframework.batch.item.xml.StaxEventItemReader.doOpen(StaxEventItemReader.java:187) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:139) ... 15 more

最佳答案

Caused by: java.lang.IllegalStateException: Input resource must exist (reader is in 'strict' mode 不言自明,资源缺失,设置'strict'模式会导致错误< br/> 如果您确定资源在正确的位置,请检查您是否使用正确的语法来识别您的资源路径(file:、classpath:、url: 或 Spring 支持的其他路径)?

关于java - 初始化读取器在 Spring 批处理中的一步失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19861131/

相关文章:

java - 如何在 Android 中从 Broadcast ONRECEIVE 更新 UI?

Java Processbuilder 流转 Python 脚本

java - 为什么 foo(Object... obj) 是在 Java1.5 中实现的?

java - 如何修复 ArrayIndexOutOfBoundsException

spring-batch - JSR 352 Spring Batch 与 Java EE

java - 单元测试中 Spring Batch JobRepository 的事务问题

java - Spring Batch : java. io.IOException:组合 MultiResourceItemWriter 和 FlatFileItemWriter 时流关闭异常

java - JAXB:类转换异常,但类具有相同的名称

spring - 如何避免 DelimitedLineTokenizer 名称中的硬编码名称?

java - 如何获取作业参数?