2014-02-19 165 views
0

我正在嘗試使用camel-stax來處理大型xml文件。一個文件內容處理工作正常,但最終失敗了以下錯誤:使用camel-stax進行文件處理無法正常工作

Caused by: java.io.IOException: Renaming file from: C:\workdir\file.xml to: C:\workdir\.camel\file.xml failed due cannot delete from file: C:\workdir\file.xml after copy succeeded 

看來,駱駝不會關閉文件輸入流,所以處理後,不能將文件移動到目標位置。當然,我可以設置noop = true,我想刪除處理過的文件。

我的路線看起來像以下:

<route id="myRoute"> 
     <from uri="file:{{working_dir}}?include=file.xml" /> 
     <split streaming="true"> 
      <ref>staxRecord</ref> 
      <to uri="log:test"/> 
     </split> 
    </route> 

最初,它是一個有點更復雜,我簡化它越好。現在看起來就像這裏的最後一個樣品http://camel.apache.org/stax

附加說明:我在Windows上執行路由。駱駝版本:2.12.2。

+0

我認爲這是一個與Windows相關的錯誤。我跑了駱駝 - stax組件測試。他們執行成功,但目標/ camle-stax-test.log文件包含相同的回溯:fpaste.org/78642/39282879 –

+0

聽起來像輸入流需要在camel-stax某處關閉 –

回答

0

所以它看起來像駱駝stax組件中的錯誤。

我發現了另一種如何處理大型XML文件的方法。我改寫了我的路線如下:

<route id="myRoute"> 
    <from uri="file:{{working_dir}}?include=file.xml&amp;delete=true" /> 
    <split streaming="true"> 
     <tokenize token="entry" xml="true"/> 
     <unmarshal ref="myJaxb"/> 
     <!-- ... --> 
    </split> 
</route> 
相關問題