pentaho/pentaho-kettle · error · KettleXMLException

SharedOjects.Readingfile.UnexpectedError

SharedOjects.Readingfile.UnexpectedError

Error message

SharedOjects.Readingfile.UnexpectedError

What it means

SharedObjects constructor throws this KettleXMLException when reading/parsing the shared-objects XML file fails unexpectedly. All shareable objects already parsed remain, but the whole read is aborted and wrapped with the message keyed SharedOjects.Readingfile.UnexpectedError (note the bundle key's typo 'Ojects'), including the file name and original cause.

Solutions

  1. Validate/repair the shared-objects XML file (open it in an XML editor); restore from backup or delete to regenerate
  2. Check e.getCause() for the exact SAX/IO error
  3. Ensure the file is not being written concurrently by another Kettle instance
  4. Verify read permissions and that the file path (sharedObjectsFile) is correct

Example fix

// before
SharedObjects so = new SharedObjects(transMeta.getFilename());
// after
File f = new File(sharedObjectsFile);
if (f.exists() && !XMLHandler.isValid(f)) {
  LOG.warn("Corrupt shared objects file " + f + ", starting fresh");
  f.renameTo(new File(f.getParent(), "shared.xml.corrupt"));
}
SharedObjects so = new SharedObjects(sharedObjectsFile);
Defensive patterns

Strategy: try-catch

Validate before calling

File f = new File(sharedObjectsFile);
if (f.exists() && !isWellFormedXml(f)) {
  LOG.warn("Corrupt shared-objects file: " + f);
}
// isWellFormedXml: parse with a DocumentBuilder to check well-formedness

Try / catch

try {
  SharedObjects so = new SharedObjects(sharedObjectsFile);
} catch (KettleXMLException e) {
  LOG.error("Failed to read " + sharedObjectsFile + ", cause: " + e.getCause(), e);
  // fall back to empty/default shared objects or restore backup
}

Prevention

When it happens

Trigger: Constructing SharedObjects where the XML file exists but SAX parsing fails: malformed/corrupt XML, unsupported root content, IO error mid-read, or an unexpected exception while storing an object (storeObject throwing a non-KettleXMLException type).

Common situations: shared.xml truncated by a previous crash or concurrent write; hand-edited shared objects file with invalid XML; version mismatch where the file contains entries an older/newer Kettle build cannot store; read permissions on the file.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/shared/SharedObjects.java:178

            if ( nodeName.equals( StepMeta.XML_TAG ) ) {
              StepMeta stepMeta = new StepMeta( node, privateDatabases, (IMetaStore) null );
              stepMeta.setDraw( false ); // don't draw it, keep it in the tree.
              isShared = stepMeta;
            } else if ( nodeName.equals( PartitionSchema.XML_TAG ) ) {
              isShared = new PartitionSchema( node );
            } else if ( nodeName.equals( ClusterSchema.XML_TAG ) ) {
              isShared = new ClusterSchema( node, privateSlaveServers );
            }

            if ( isShared != null ) {
              isShared.setShared( true );
              storeObject( isShared );
            }
          }
        }
      }
    } catch ( Exception e ) {
      throw new KettleXMLException( BaseMessages.getString( PKG, "SharedOjects.Readingfile.UnexpectedError",
        sharedObjectsFile ), e );
    }
  }

  public static final String createFilename( String sharedObjectsFile ) {
    String filename;
    if ( Utils.isEmpty( sharedObjectsFile ) ) {
      // First fallback is the environment/kettle variable ${KETTLE_SHARED_OBJECTS}
      // This points to the file
      filename = Variables.getADefaultVariableSpace().getVariable( Const.KETTLE_SHARED_OBJECTS );

      // Last line of defence...
      if ( Utils.isEmpty( filename ) ) {
        filename = Const.getSharedObjectsFile();
      }
    } else {
      filename = sharedObjectsFile;
    }

View on GitHub (pinned to f3058517a1)