{"record":{"id":"79fb7b3db6338e4d","repo":"pentaho/pentaho-kettle","slug":"xsdvalidator-exception-cannotcreateschema","errorCode":null,"errorMessage":"XsdValidator.Exception.CannotCreateSchema","messagePattern":"XsdValidator\\.Exception\\.CannotCreateSchema","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java","lineNumber":219,"sourceCode":"            logError( BaseMessages.getString( PKG, \"XsdValidator.Log.Error.XMLfileMissing\", XMLFieldvalue ) );\n            throw new KettleStepException( BaseMessages.getString( PKG, \"XsdValidator.Exception.XMLfileMissing\",\n                XMLFieldvalue ) );\n          }\n          sourceXML = new StreamSource( xmlfileValidator.getContent().getInputStream() );\n        }\n\n        // create the schema\n        Schema SchematXSD = null;\n        if ( xsdfile instanceof AbstractFileObject ) {\n          if ( xsdfile.getName().getURI().contains( \"ram:///\" ) ) {\n            SchematXSD = factoryXSDValidator.newSchema( new StreamSource( xsdfile.getContent().getInputStream() ) );\n          } else {\n            SchematXSD = factoryXSDValidator.newSchema( new File( KettleVFS.getFilename( xsdfile ) ) );\n          }\n        } else {\n          // we should not get here as anything entered in that does not look like\n          // a url should be made a FileObject.\n          throw new KettleStepException( BaseMessages.getString( PKG, \"XsdValidator.Exception.CannotCreateSchema\",\n              xsdfile.getClass().getName() ) );\n        }\n\n        if ( meta.getXSDSource().equals( meta.NO_NEED ) ) {\n          // ---Some documents specify the schema they expect to be validated against,\n          // ---typically using xsi:noNamespaceSchemaLocation and/or xsi:schemaLocation attributes\n          // ---Schema SchematXSD = factoryXSDValidator.newSchema();\n          SchematXSD = factoryXSDValidator.newSchema();\n        }\n\n        // Create XSDValidator\n        Validator xsdValidator = SchematXSD.newValidator();\n\n        // Prevent against XML Entity Expansion (XEE) attacks.\n        // https://www.owasp.org/index.php/XML_Security_Cheat_Sheet#XML_Entity_Expansion\n        if ( !meta.isAllowExternalEntities() ) {\n          xsdValidator.setFeature( \"http://apache.org/xml/features/disallow-doctype-decl\", true );\n          xsdValidator.setFeature( \"http://xml.org/sax/features/external-general-entities\", false );","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java#L201-L237","documentation":"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.","triggerScenarios":"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.","commonSituations":"Using unusual VFS schemes (custom plugins) for the XSD; Kettle/VFS version differences changing FileObject implementation classes; copying a schema over an unsupported protocol.","solutions":["Use a local file path or standard scheme (file/http) for the XSD filename","Check the class name in the message to identify which VFS provider returned the object","Upgrade/align Pentaho Kettle and VFS library versions","Pre-copy the schema locally in a preceding step and validate against the local copy"],"exampleFix":"// before\nmeta.setXSDFilename(\"webdav://host/schemas/order.xsd\"); // unsupported provider\n// after\nmeta.setXSDFilename(\"/opt/pdi/schemas/order.xsd\");","handlingStrategy":"try-catch","validationCode":"// Only use file:// or http(s):// or plain paths for the XSD\nif (!(path.startsWith(\"http\") || !path.contains(\"://\"))) { throw new IllegalArgumentException(\"Unsupported XSD scheme: \" + path); }","typeGuard":null,"tryCatchPattern":"try { run(); } catch (KettleStepException e) { if (e.getMessage().contains(\"CannotCreateSchema\")) { localizeSchema(path); } else { throw e; } }","preventionTips":["Stick to local files or http(s) URLs for schemas","Avoid exotic VFS plugins for the XSD source","Pin consistent Kettle/VFS versions across environments"],"tags":["kettle","xsd-validator","schema-factory","unsupported-type"],"backgroundTag":"unsupported-operation","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}