{"record":{"id":"9e41cf52434d73b2","repo":"prestodb/presto","slug":"emr-file-system-class-not-found","errorCode":null,"errorMessage":"EMR File System class not found: ","messagePattern":"EMR File System class not found: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/s3/HiveS3Module.java","lineNumber":99,"sourceCode":"    }\n\n    private void bindSecurityMapping(Binder binder)\n    {\n        if (buildConfigObject(AWSSecurityMappingConfig.class).getConfigFile().isPresent() &&\n                buildConfigObject(AWSSecurityMappingConfig.class).getMappingType().equals(S3)) {\n            newSetBinder(binder, DynamicConfigurationProvider.class).addBinding()\n                    .to(AWSS3SecurityMappingConfigurationProvider.class).in(Scopes.SINGLETON);\n        }\n    }\n\n    private static void validateEmrFsClass()\n    {\n        // verify that the class exists\n        try {\n            Class.forName(EMR_FS_CLASS_NAME, true, JavaUtils.getClassLoader());\n        }\n        catch (ClassNotFoundException e) {\n            throw new RuntimeException(\"EMR File System class not found: \" + EMR_FS_CLASS_NAME, e);\n        }\n    }\n\n    public static class EmrFsS3ConfigurationUpdater\n            implements S3ConfigurationUpdater\n    {\n        @Override\n        public void updateConfiguration(Configuration config)\n        {\n            // re-map filesystem schemes to use the Amazon EMR file system\n            config.set(\"fs.s3.impl\", EMR_FS_CLASS_NAME);\n            config.set(\"fs.s3a.impl\", EMR_FS_CLASS_NAME);\n            config.set(\"fs.s3n.impl\", EMR_FS_CLASS_NAME);\n        }\n    }\n\n    public static class HadoopDefaultConfigurationUpdater\n            implements S3ConfigurationUpdater","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/s3/HiveS3Module.java#L81-L117","documentation":"HiveS3Module.validateEmrFsClass (called from setup when hive.s3-file-system-type=EMRFS) loads com.amazon.ws.emr.hadoop.fs.EmrFileSystem via Class.forName; a ClassNotFoundException is rethrown as RuntimeException 'EMR File System class not found: ...'. The connector requires the EMRFS jar on the classpath to use EMR's S3 FileSystem, and startup fails fast when it is missing.","triggerScenarios":"Configuring hive.s3-file-system-type=EMRFS in the Hive catalog on a non-EMR cluster (or Presto distribution) that does not bundle the EMRFS libraries (emrfs-hadoop-connector jar), so Class.forName fails during connector plugin initialization.","commonSituations":"Running Presto on a plain EC2/AMI instead of EMR while copying EMR-style hive.properties; upgrading Presto where EMRFS jars are no longer bundled; missing hive.jar-path/classpath entry pointing at /usr/share/aws/emr/emrfs/lib; deploying the catalog config to all nodes when only some have the EMR jars.","solutions":["Either add the EMRFS connector jar (emrfs-hadoop-connector-*.jar from /usr/share/aws/emr/emrfs/lib on EMR) to the Presto plugin/hive classpath on every node.","Or change hive.s3-file-system-type back to PRESTO (or HADOOP_DEFAULT) if you don't actually need EMRFS features (consistent view, S3 encryption defaults).","Ensure the same classpath fix is applied to ALL coordinator/worker nodes, then restart Presto.","Verify with: java -cp <presto-classpath> Class.forName check or simply grep the plugin dir for emrfs jars."],"exampleFix":"// before: etc/catalog/hive.properties on non-EMR host\nhive.s3-file-system-type=EMRFS\n// after\nhive.s3-file-system-type=PRESTO\nhive.s3.endpoint=s3.us-east-1.amazonaws.com","handlingStrategy":"validation","validationCode":"// before enabling EMRFS, ensure the class is on the plugin classpath on this node\ntry {\n    Class.forName(\"com.amazon.ws.emr.hadoop.fs.EmrFileSystem\", true, Thread.currentThread().getContextClassLoader());\n} catch (ClassNotFoundException e) {\n    throw new IllegalStateException(\"EMRFS jar missing; add emrfs-hadoop-connector to the hive plugin dir or use PRESTO type\");\n}","typeGuard":"boolean emrFsAvailable() {\n    try { Class.forName(\"com.amazon.ws.emr.hadoop.fs.EmrFileSystem\", false, JavaUtils.getClassLoader()); return true; }\n    catch (ClassNotFoundException e) { return false; }\n}","tryCatchPattern":"try {\n    return pluginManager.loadCatalog(\"hive\", props);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"EMR File System class not found:\")) {\n        throw new ConfigException(\"Deploy EMRFS jars to all nodes or set hive.s3-file-system-type=PRESTO\");\n    }\n    throw e;\n}","preventionTips":["Only set EMRFS on clusters that actually ship the EMRFS connector jars.","Check the hive plugin directory on EVERY node for emrfs jars after image/build changes.","Pin the EMRFS jar version compatible with your Hadoop/Presto versions.","Document required classpath additions in your deployment tooling."],"tags":["s3","emrfs","classpath","configuration","startup"],"backgroundTag":"class-not-found","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}