pentaho/pentaho-kettle · error · KettleException
Unable to load image from classpath
Error message
Unable to load image from classpath : '<fileName>'
What it means
In SwingGC.getImageIcon, the SVG branch (SvgSupport enabled, .svg name) wraps any exception from SvgSupport.loadSvgImage as KettleException("Unable to load image from classpath : '<fileName>'", ex). The input comes from FileInputStream on the given name, so parsing/IO failures on the SVG file surface under this misleading 'classpath' message.
Solutions
- Check the wrapped cause to identify the parse vs IO failure and fix the SVG file.
- Validate the SVG externally (browser/editor) and re-export if needed.
- Disable SVG support and ship PNG icons if the renderer library is unavailable.
- Confirm file read permissions on the icon path.
Example fix
// before // broken logo.svg -> KettleException: Unable to load image from classpath : 'logo.svg' // after // use a valid SVG or fall back: String fileName = svgIsValid ? "logo.svg" : "logo.png";
Defensive patterns
Strategy: try-catch
Validate before calling
File svg = new File(fileName);
if (!svg.isFile() || svg.length() == 0) { fileName = PNG_FALLBACK; }
else if (!looksLikeSvg(svg)) { fileName = PNG_FALLBACK; } Try / catch
try {
image = gc.getImageIcon(fileName);
} catch (KettleException e) {
Throwable cause = e.getCause();
log.error("SVG parse failed for " + fileName + ": " + cause, cause);
image = loadPngFallback(fileName);
} Prevention
- Ensure SVG rendering dependencies ship with the application.
- Validate all SVG assets at build time.
- Keep PNG fallbacks alongside SVG icons.
- Watch for deployments that strip optional jars (renderer libraries).
When it happens
Trigger: SVG-enabled environment, .svg fileName, and loadSvgImage throws — malformed SVG XML, unreadable file, or missing/broken SVG rendering library.
Common situations: Missing SVG renderer dependency in headless or minimal deployments; corrupt or wrong-content .svg icons; SVGs using unsupported features.
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/42bb3b3971aa2ff3.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/core/gui/SwingGC.java:276
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)