2013-01-09 38 views
0

從過去的幾天來看,我收到了這個錯誤,無法前進。
請找到錯誤日誌和內容,並幫助我找出問題。
我的文件被物理地離開在下面提及的位置(X:/Content/E/data/FIXED.dat)。Reissing彈簧錯誤:資源必須存在:[class path resource [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 
+0

您是否有URL試圖代替的路徑? (file:/ X:....) – YMomb

+0

你可以舉一些例子。我沒有得到URL模式。感謝您的快速回復 –

回答

3

嘗試用這種

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

高超的工作和出色的快速反應:-)它工作。非常感謝Pradeep –

+0

如果這個迴應解決了你的問題,你可以接受anwser。 – NPKR

+0

我是新來這個網站..你可以告訴我怎麼做? –

0

在你的配置中,Spring正在類路徑中尋找該路徑(參見堆棧跟蹤)。無論是作爲與

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

已經建議加載文件或文件FIXED.dat移動到應用程序類路徑,並更改屬性

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

雙方應努力

+0

非常感謝mardavi –

相關問題