2010-07-19 51 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,它会把你可以张贴代码更容易分析问题。

相关问题