pentaho/pentaho-kettle · error · KettleStepException

XsdValidator.Exception.CannotCreateSchema

Error message

XsdValidator.Exception.CannotCreateSchema

What it means

KettleStepException raised as a defensive branch when the resolved XSD FileObject is neither a URL nor a File-backed VFS object, so the SchemaFactory cannot build the Schema. The code comments state this should normally be unreachable.

Solutions

  1. Use a local file path or standard scheme (file/http) for the XSD filename
  2. Check the class name in the message to identify which VFS provider returned the object
  3. Upgrade/align Pentaho Kettle and VFS library versions
  4. Pre-copy the schema locally in a preceding step and validate against the local copy

Example fix

// before
meta.setXSDFilename("webdav://host/schemas/order.xsd"); // unsupported provider
// after
meta.setXSDFilename("/opt/pdi/schemas/order.xsd");
Defensive patterns

Strategy: try-catch

Validate before calling

// Only use file:// or http(s):// or plain paths for the XSD
if (!(path.startsWith("http") || !path.contains("://"))) { throw new IllegalArgumentException("Unsupported XSD scheme: " + path); }

Try / catch

try { run(); } catch (KettleStepException e) { if (e.getMessage().contains("CannotCreateSchema")) { localizeSchema(path); } else { throw e; } }

Prevention

When it happens

Trigger: The XSD FileObject resolved by KettleVFS has a content/file type the newSchema() branch does not handle — an exotic VFS provider returning a custom FileObject class, or xsdfile of unexpected type.

Common situations: Using unusual VFS schemes (custom plugins) for the XSD; Kettle/VFS version differences changing FileObject implementation classes; copying a schema over an unsupported protocol.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/79fb7b3db6338e4d. Report an issue: GitHub.

Appendix: source

Thrown at plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java:219

            logError( BaseMessages.getString( PKG, "XsdValidator.Log.Error.XMLfileMissing", XMLFieldvalue ) );
            throw new KettleStepException( BaseMessages.getString( PKG, "XsdValidator.Exception.XMLfileMissing",
                XMLFieldvalue ) );
          }
          sourceXML = new StreamSource( xmlfileValidator.getContent().getInputStream() );
        }

        // create the schema
        Schema SchematXSD = null;
        if ( xsdfile instanceof AbstractFileObject ) {
          if ( xsdfile.getName().getURI().contains( "ram:///" ) ) {
            SchematXSD = factoryXSDValidator.newSchema( new StreamSource( xsdfile.getContent().getInputStream() ) );
          } else {
            SchematXSD = factoryXSDValidator.newSchema( new File( KettleVFS.getFilename( xsdfile ) ) );
          }
        } else {
          // we should not get here as anything entered in that does not look like
          // a url should be made a FileObject.
          throw new KettleStepException( BaseMessages.getString( PKG, "XsdValidator.Exception.CannotCreateSchema",
              xsdfile.getClass().getName() ) );
        }

        if ( meta.getXSDSource().equals( meta.NO_NEED ) ) {
          // ---Some documents specify the schema they expect to be validated against,
          // ---typically using xsi:noNamespaceSchemaLocation and/or xsi:schemaLocation attributes
          // ---Schema SchematXSD = factoryXSDValidator.newSchema();
          SchematXSD = factoryXSDValidator.newSchema();
        }

        // Create XSDValidator
        Validator xsdValidator = SchematXSD.newValidator();

        // Prevent against XML Entity Expansion (XEE) attacks.
        // https://www.owasp.org/index.php/XML_Security_Cheat_Sheet#XML_Entity_Expansion
        if ( !meta.isAllowExternalEntities() ) {
          xsdValidator.setFeature( "http://apache.org/xml/features/disallow-doctype-decl", true );
          xsdValidator.setFeature( "http://xml.org/sax/features/external-general-entities", false );

View on GitHub (pinned to f3058517a1)