pentaho/pentaho-kettle · error · KettleException
Unable to load image from classpath
Error message
Unable to load image from classpath : '<fileName>'
What it means
In SwingDirectGC.getImageIcon, when SVG support is enabled and the name is an .svg file, SvgSupport.loadSvgImage(inputStream) is invoked; any exception while parsing the SVG is wrapped in KettleException("Unable to load image from classpath : '<fileName>'", ex). Despite the wording, the stream here comes from FileInputStream on the given path, so the failure is usually a corrupt/unreadable SVG on disk.
Solutions
- Read the wrapped cause (ex.getCause()) to see the real parse/IO error and fix the SVG file.
- Validate the SVG opens in a browser/editor; re-export a clean SVG for the icon.
- Disable SVG support (use PNG/BMP icons) if the SVG renderer dependency is unavailable in your deployment.
- Check that the file at the path is readable by the process user.
Example fix
// before (corrupt icon.svg on disk) // KettleException: Unable to load image from classpath : 'icon.svg' // after // replace icon.svg with a valid SVG, or switch to PNG: String fileName = "icon.png"; // skips the SVG branch
Defensive patterns
Strategy: try-catch
Validate before calling
File svg = new File(fileName);
if (!svg.isFile() || svg.length() == 0) throw new IOException("missing/empty svg: " + fileName);
if (!new String(java.nio.file.Files.readAllBytes(svg.toPath()), StandardCharsets.US_ASCII)
.startsWith("<?xml") && !filesBytesStartsWith(svg, "<svg")) log.warn("file does not look like SVG"); Try / catch
try {
gc.getImageIcon(fileName);
} catch (KettleException e) {
Throwable cause = e.getCause();
log.error("SVG load failed for " + fileName + ": " + cause, cause);
image = loadPngFallback(fileName);
} Prevention
- Keep the SVG rendering library on the classpath in all deployments.
- Validate SVG assets in CI (parse them headlessly before shipping).
- Ship PNG fallbacks next to SVG icons.
- Never hand-edit shipped SVGs without re-validating.
When it happens
Trigger: SVG support enabled (SvgSupport.isSvgEnabled() true) and fileName ends with an SVG extension, but loadSvgImage throws — corrupt SVG XML, file unreadable mid-read, unsupported SVG features, or a broken SVG renderer (e.g. missing BatX/SVGSalamander dependency).
Common situations: Deployments where the SVG rendering library is absent so SVG parsing fails; truncated or hand-edited .svg icon files; icons replaced with non-SVG content keeping the .svg extension.
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
- Unable to load image from classpath
- Image icon file name can not be null
- Image icon file name can not be null
- Unable to load image from file
- A connection of type PALO is expected
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/19cb0d8de5e3fd96.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/core/gui/SwingDirectGC.java:270
if ( inputStream == null ) {
try {
inputStream = new FileInputStream( "/" + fileName );
} catch ( FileNotFoundException ex ) {
// no need to fail
}
}
if ( inputStream == null ) {
inputStream = getClass().getResourceAsStream( fileName );
}
if ( inputStream == null ) {
inputStream = getClass().getResourceAsStream( "/" + fileName );
}
if ( inputStream != null ) {
try {
SvgImage svg = SvgSupport.loadSvgImage( inputStream );
image = new SwingUniversalImageSvg( svg );
} catch ( Exception ex ) {
throw new KettleException( "Unable to load image from classpath : '" + fileName + "'", ex );
} finally {
IOUtils.closeQuietly( inputStream );
}
}
}
if ( image == null ) {
fileName = SvgSupport.toPngName( fileName );
try {
inputStream = new FileInputStream( fileName );
} catch ( FileNotFoundException ex ) {
// no need to fail
}
if ( inputStream == null ) {
try {
inputStream = new FileInputStream( "/" + fileName );
} catch ( FileNotFoundException ex ) {View on GitHub (pinned to f3058517a1)