2010-07-19 50 views
1

從Linux操作系統運行BIRT時,出現以下異常。什麼是非Windows系統中絕對路徑的URL等價物?

造成的:org.eclipse.datatools.connectivity.oda.OdaException:無協議:/home/lsingh/reporting/tmp/execution1279514184559/TDReport.xml

其中「/家/ lsingh /報告/ tmp目錄/execution1279514184559/TDReport.xml「是我的XML數據文件。

當我查看BIRT中的「org.eclipse.birt.report.data.oda.xml.util.XMLDataInputStreamCreator」類的代碼時,我看到了這種懷疑來自於下面的一段代碼。

catch (MalformedURLException e) 
{ 
    throw new OdaException(e.getLocalizedMessage()); 
} 

這意味着代碼試圖將上面指定的文件路徑轉換爲URL,並且失敗。

所以我的問題是如何將非Windows路徑轉換爲URL? 是否應以file:///爲前綴?

回答

5

Windows與否,本地文件的所有URL都以file://開頭。這是協議前綴。

所以,你的文件將是:

file:// + /home/lsingh/reporting/tmp/execution1279514184559/TDReport.xml = file:///home/lsingh/reporting/tmp/execution1279514184559/TDReport.xml

0

您可以嘗試使用文件URL:

file:///home/lsingh/reporting/tmp/execution1279514184559/TDReport.xml 

如果不是調用BIRT,它會把你可以張貼代碼更容易分析問題。

相關問題