gpt4 book ai didi

java - 错误: Encountered an error executing the step org. springframework.batch.item.ItemStreamException:无法初始化阅读器

转载 作者:太空宇宙 更新时间:2023-11-04 14:57:09 25 4
gpt4 key购买 nike

这是我的 FlatFileItemReader 配置

<beans:bean id="myFileItemReader"
class="org.springframework.batch.item.file.FlatFileItemReader"
p:resource="file://tmp/my-#{jobParameters[date]}/data.txt"
p:lineMapper-ref="myLineMapper" scope="step"/>

我收到此错误

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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:132)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:120)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy25.open(Unknown Source)
at org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:96)
at org.springframework.batch.core.step.tasklet.TaskletStep.open(TaskletStep.java:307)
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195)
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:144)
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:67)
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:163)
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:142)
at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:134)
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:304)
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.net.UnknownHostException: tmp
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at sun.net.ftp.impl.FtpClient.doConnect(FtpClient.java:958)
at sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:918)
at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1013)
at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:999)
at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:294)
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:393)
at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:125)
at org.springframework.batch.item.file.DefaultBufferedReaderFactory.create(DefaultBufferedReaderFactory.java:34)
at org.springframework.batch.item.file.FlatFileItemReader.doOpen(FlatFileItemReader.java:266)
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.open(AbstractItemCountingItemStreamItemReader.java:139)

最佳答案

我认为这不是有效的 URL,因为您使用了 file://tmp/... 而不是 file:/tmp/...。我从未见过文件协议(protocol)与双 // 一起使用,但我猜它可能用于通过网络共享的文件,并且 tmp 不是您的可解析主机网络。正如您所看到的,Spring 尝试使用 FTP 协议(protocol)来访问该文件,而您可能想要访问本地文件。

关于java - 错误: Encountered an error executing the step org. springframework.batch.item.ItemStreamException:无法初始化阅读器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23062293/

25 4 0
文章推荐: c++ - vector 迭代器
文章推荐: javascript - 将 HTML 表格(作为字符串)转换为 JS 对象数组
文章推荐: css - 试图在 <header> 中将
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com