0

从过去几天开始,我收到此错误并且无法继续前进。
请找到错误日志和内容,并帮助我找出问题所在。
我的文件在下面提到的位置物理退出。(X:/Content/E/data/FIXED.dat)

DWHConfig.xml

    <bean id="reader" class="org.springframework.batch.item.file.FlatFileItemReader">
    <property name="resource" value="X:/Content/E/data/FIXED.dat"/>
    <property name="firstLineIsHeader" value="false"/>
    <property name="recordSeparatorPolicy">
    <bean class="org.springframework.batch.item.file.separator.SimpleRecordSeparatorPolicy" />               </property>
    <property name="lineTokenizer">
    <bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
    <property name="delimiter" value="|"/>
    </bean>
    </property>
    <property name="fieldSetMapper">
    <bean class="com.telenor.metro2.conn.ess.batch.DWH.maping.DWHInput_Mapper" />
    </property>
    </bean>

错误

Jan 9, 2013 2:16:44 PM org.springframework.batch.core.step.AbstractStep execute
SEVERE: Encountered an error executing the step: class org.springframework.batch.core.UnexpectedJobExecutionException: Failed to initialize the step
Jan 9, 2013 2:16:45 PM org.springframework.batch.core.launch.support.SimpleJobLauncher$1 run
INFO: Job: [SimpleJob: [name=DWHDailyJob]] failed with the following parameters: [{jobName=DWH-Fixed_daily_dap-ess-ora01}{}{}{schedule.date=Wed Jan 09 00:00:00 GMT+05:30 2013}]
Throwable occurred: org.springframework.batch.core.UnexpectedJobExecutionException: Failed to initialize the step
    at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:170)
    at org.springframework.batch.core.job.SimpleJob.execute(SimpleJob.java:100)
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:86)
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
    at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:81)
    at com.telenor.metro2.conn.ess.batch.launcher.DWHFJobDetail.start(DWHFJobDetail.java:103)
    at com.telenor.metro2.conn.ess.batch.launcher.DWHFJobDetail.execute(DWHFJobDetail.java:47)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: org.springframework.batch.item.ItemStreamException: Failed to initialize the reader
    at org.springframework.batch.item.support.AbstractBufferedItemReaderItemStream.open(AbstractBufferedItemReaderItemStream.java:157)
    at org.springframework.batch.item.support.CompositeItemStream.open(CompositeItemStream.java:103)
    at org.springframework.batch.core.step.item.ItemOrientedStep.open(ItemOrientedStep.java:439)
    at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:167)
    ... 8 more
**Caused by: java.lang.IllegalStateException: Resource must exist: [class path resource [X:/Content/E/data/FIXED.dat**]]
    at org.springframework.util.Assert.state(Assert.java:384)
    at org.springframework.batch.item.file.FlatFileItemReader.doOpen(FlatFileItemReader.java:226)
    at org.springframework.batch.item.support.AbstractBufferedItemReaderItemStream.open(AbstractBufferedItemReaderItemStream.java:154)
    ... 11 more
4

2 回答 2

3

试试这个

<property name="resource" value="file:X:/Content/E/data/FIXED.dat"/>
于 2013-01-09T09:13:58.500 回答
0

使用您的配置,Spring 正在其类路径中寻找该路径(请参阅堆栈跟踪)。按照建议加载您的文件

<property name="resource" value="file:X:/Content/E/data/FIXED.dat"/>

或将文件 FIXED.dat 移动到应用程序类路径中并将属性更改为

<property name="resource" value="classpath:FIXED.dat"/>

两者都应该工作

于 2013-01-09T09:19:58.237 回答