{"record":{"id":"821932bbafa63d7f","repo":"pentaho/pentaho-kettle","slug":"sharedojects-readingerror","errorCode":"SharedOjects.ReadingError","errorMessage":"${SharedOjects.ReadingError}","messagePattern":"\\$\\{SharedOjects\\.ReadingError\\}","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/shared/VfsSharedObjectsIO.java","lineNumber":115,"sourceCode":"   * where key can be {\"connection\", \"slaveserver\", \"partitionschema\" or clusterschema\"} and\n   * value will be xml Node.\n   *\n   * @param pathToSharedObjectFile The path to the shared object file\n   * @throws KettleXMLException\n   */\n  private void loadSharedObjectNodeMap( String pathToSharedObjectFile ) throws KettleXMLException {\n\n    try {\n      // Get the FileObject\n      FileObject file = KettleVFS.getInstance( bowl ).getFileObject( pathToSharedObjectFile );\n\n      // If we have a shared file, load the content, otherwise, just keep this one empty\n      if ( file.exists() ) {\n        Document document = XMLHandler.loadXMLFile( file );\n        loadSharedObjectsNodeMap( document );\n      }\n    } catch ( Exception e ) {\n      throw new KettleXMLException( BaseMessages.getString( PKG, \"SharedOjects.ReadingError\",\n        pathToSharedObjectFile ), e );\n    }\n  }\n\n  private Optional<String> createOrGetFileBackup( FileObject fileObject ) throws IOException, KettleException {\n    String backupFileName = sharedObjectsFile + \".backup\";\n    boolean isBackupFileExist;\n    if ( fileObject.exists() ) {\n      isBackupFileExist = createFileBackup( backupFileName );\n    } else {\n      isBackupFileExist = getBackupFileFromFileSystem( backupFileName );\n    }\n    return isBackupFileExist ? Optional.ofNullable( backupFileName ) : Optional.empty();\n  }\n\n  private boolean createFileBackup( String backupFileName ) throws IOException, KettleFileException {\n    return copyFile( sharedObjectsFile, backupFileName );\n  }","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/shared/VfsSharedObjectsIO.java#L97-L133","documentation":"VfsSharedObjectsIO.loadSharedObjectNodeMap throws KettleXMLException with the localized 'SharedOjects.ReadingError' message when any exception occurs while reading or parsing the shared objects XML file. The original exception is preserved as the cause, and pathToSharedObjectFile identifies the file that failed.","triggerScenarios":"Calling loadSharedObjectNodeMap when the shared objects file exists but XMLHandler.loadXMLFile fails — malformed XML, encoding problems, or IO/read errors on the VFS file.","commonSituations":"Corrupted or truncated shared.xml (e.g. after a failed write or crash); a partially restored .backup file; a VFS/network file that was readable at exists() check but failed during load.","solutions":["Inspect the cause chain (KettleXMLException.getCause()) to find the exact XML parse or IO error.","Validate/repair the shared objects XML file, or restore a known-good copy (including the .backup sibling if present).","If the file is corrupt beyond repair, move it aside and let Pentaho recreate an empty one, re-adding shared objects.","Verify file readability/permissions and VFS connectivity before loading."],"exampleFix":"// before\nDocument doc = XMLHandler.loadXMLFile( file ); // throws KettleXMLException on corrupt file\n// after\ntry {\n  Document doc = XMLHandler.loadXMLFile( file );\n} catch ( KettleXMLException e ) {\n  // restore from sharedObjectsFile + \".backup\" or regenerate the file\n}","handlingStrategy":"try-catch","validationCode":"File f = new File( pathToSharedObjectFile );\nif ( f.exists() && f.canRead() && f.length() > 0 ) { /* safe to attempt load */ }","typeGuard":null,"tryCatchPattern":"try {\n  io.loadSharedObjectNodeMap();\n} catch ( KettleXMLException e ) {\n  // restore from .backup or regenerate the shared objects file\n  log.error( \"Reading shared objects failed: \" + e.getCause() );\n}","preventionTips":["Keep backups of shared.xml before upgrades","Validate XML after any manual edit","Check disk space/process interruption causes of truncated XML"],"tags":["file-read-failed","xml","parse-error","shared-objects"],"backgroundTag":"file-read-failed","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"}