prestodb/presto · critical · RuntimeException

EMR File System class not found:

Error message

EMR File System class not found: 

What it means

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.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/s3/HiveS3Module.java:99

    }

    private void bindSecurityMapping(Binder binder)
    {
        if (buildConfigObject(AWSSecurityMappingConfig.class).getConfigFile().isPresent() &&
                buildConfigObject(AWSSecurityMappingConfig.class).getMappingType().equals(S3)) {
            newSetBinder(binder, DynamicConfigurationProvider.class).addBinding()
                    .to(AWSS3SecurityMappingConfigurationProvider.class).in(Scopes.SINGLETON);
        }
    }

    private static void validateEmrFsClass()
    {
        // verify that the class exists
        try {
            Class.forName(EMR_FS_CLASS_NAME, true, JavaUtils.getClassLoader());
        }
        catch (ClassNotFoundException e) {
            throw new RuntimeException("EMR File System class not found: " + EMR_FS_CLASS_NAME, e);
        }
    }

    public static class EmrFsS3ConfigurationUpdater
            implements S3ConfigurationUpdater
    {
        @Override
        public void updateConfiguration(Configuration config)
        {
            // re-map filesystem schemes to use the Amazon EMR file system
            config.set("fs.s3.impl", EMR_FS_CLASS_NAME);
            config.set("fs.s3a.impl", EMR_FS_CLASS_NAME);
            config.set("fs.s3n.impl", EMR_FS_CLASS_NAME);
        }
    }

    public static class HadoopDefaultConfigurationUpdater
            implements S3ConfigurationUpdater

View on GitHub (pinned to 55bb57d202)

Solutions

  1. 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.
  2. 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).
  3. Ensure the same classpath fix is applied to ALL coordinator/worker nodes, then restart Presto.
  4. Verify with: java -cp <presto-classpath> Class.forName check or simply grep the plugin dir for emrfs jars.

Example fix

// before: etc/catalog/hive.properties on non-EMR host
hive.s3-file-system-type=EMRFS
// after
hive.s3-file-system-type=PRESTO
hive.s3.endpoint=s3.us-east-1.amazonaws.com
Defensive patterns

Strategy: validation

Validate before calling

// before enabling EMRFS, ensure the class is on the plugin classpath on this node
try {
    Class.forName("com.amazon.ws.emr.hadoop.fs.EmrFileSystem", true, Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException e) {
    throw new IllegalStateException("EMRFS jar missing; add emrfs-hadoop-connector to the hive plugin dir or use PRESTO type");
}

Type guard

boolean emrFsAvailable() {
    try { Class.forName("com.amazon.ws.emr.hadoop.fs.EmrFileSystem", false, JavaUtils.getClassLoader()); return true; }
    catch (ClassNotFoundException e) { return false; }
}

Try / catch

try {
    return pluginManager.loadCatalog("hive", props);
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("EMR File System class not found:")) {
        throw new ConfigException("Deploy EMRFS jars to all nodes or set hive.s3-file-system-type=PRESTO");
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/9e41cf52434d73b2. Report an issue: GitHub.