Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
3.2.1
Description
When we create a configuration file, which load a external XML file with relative path, and try to load it via calling `Configuration.addResource` with `Path(URI)`, we got an error, which failed to load a external XML, after https://issues.apache.org/jira/browse/HADOOP-14216 is merged.
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Fetch fail on include for 'mountTable.xml' with no fallback while loading 'file:/opt/hadoop/etc/hadoop/core-site.xml' at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:3021) at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2973) at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2848) at org.apache.hadoop.conf.Configuration.iterator(Configuration.java:2896) at com.company.test.Main.main(Main.java:29) Caused by: java.io.IOException: Fetch fail on include for 'mountTable.xml' with no fallback while loading 'file:/opt/hadoop/etc/hadoop/core-site.xml' at org.apache.hadoop.conf.Configuration$Parser.handleEndElement(Configuration.java:3271) at org.apache.hadoop.conf.Configuration$Parser.parseNext(Configuration.java:3331) at org.apache.hadoop.conf.Configuration$Parser.parse(Configuration.java:3114) at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:3007) ... 4 more
The cause is that the URI is passed as string to java.io.File constructor and File does not support the file URI, so my suggestion is trying to convert from string to URI at first.
Attachments
Issue Links
- links to