pentaho/pentaho-kettle · error · KettleXMLException
Error reading information from resource
Error message
Error reading information from resource
What it means
The File-based loadXMLFile(File) overload reads the file via its URI and wraps any exception during stream open/parse/close in a KettleXMLException with message "Error reading information from resource". Like the URL variant, the true cause is preserved in the chained exception.
Solutions
- Check the file exists and is readable (canRead()) before loading.
- Validate the XML content and its declared encoding; re-save as clean UTF-8 without BOM if needed.
- Inspect e.getCause() for the underlying SAX/IO error.
- Confirm the path has no characters that break URI conversion (spaces are OK, but '#' or '%' are not).
Example fix
// before
Document doc = XMLHandler.loadXMLFile(new File(path));
// after
File f = new File(path);
if (!f.isFile() || !f.canRead()) throw new KettleException("Cannot read " + path);
try {
Document doc = XMLHandler.loadXMLFile(f);
} catch (KettleXMLException e) {
throw new KettleException("Bad XML in " + path + ": " + e.getCause(), e);
} Defensive patterns
Strategy: validation
Validate before calling
File f = new File(path);
if (!f.isFile() || !f.canRead()) throw new KettleException("Unreadable: " + path); Type guard
boolean isReadableXml(File f) {
return f != null && f.isFile() && f.canRead();
} Try / catch
try {
doc = XMLHandler.loadXMLFile(file);
} catch (KettleXMLException e) {
throw new KettleException("Invalid XML resource " + file + ": " + e.getCause(), e);
} Prevention
- Check exists/canRead before parsing
- Save XML as clean UTF-8 without BOM
- Avoid reserved URI characters (#, %) in paths
When it happens
Trigger: XMLHandler.loadXMLFile(File) where resource.toURI().toURL() stream fails to open (missing file, no read permission) or the parser rejects the content (malformed XML, wrong encoding).
Common situations: Plugin or metadata files with unreadable permissions, invalid characters in file paths breaking URI conversion, corrupt XML files, BOM or encoding mismatches (e.g. file saved as UTF-16 but declared UTF-8).
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- AnalyticQueryMeta.Exception.UnableToLoadStepInfoFromXML
- Error_0001
- ERROR_0001
- Error loading transformation executor details from XML
- Error parsing XML
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/d6b19ca8e579d6c7.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/xml/XMLHandler.java:725
DocumentBuilder db;
Document doc;
try {
// Check and open XML document
dbf = XMLParserFactoryProducer.createSecureDocBuilderFactory();
db = dbf.newDocumentBuilder();
InputStream inputStream = resource.openStream();
try {
doc = db.parse( inputStream );
} catch ( IOException ef ) {
throw new KettleXMLException( ef );
} finally {
inputStream.close();
}
return doc;
} catch ( Exception e ) {
throw new KettleXMLException( "Error reading information from resource", e );
}
}
/**
* Load a String into an XML document using the cached default DocumentBuilder.
* Uses ThreadLocal-cached DocumentBuilder to avoid expensive factory creation (~60% overhead reduction).
* This is the most common path for XML string parsing.
*
* Configuration: namespaceAware=false, deferNodeExpansion=true
*
* @param string The XML text to load into a document
* @return the parsed Document
* @throws KettleXMLException if parsing fails
*/
public static Document loadXMLString( String string ) throws KettleXMLException {
return loadXMLString( DEFAULT_BUILDER_CACHE.get(), string );
}
View on GitHub (pinned to f3058517a1)