apache/cassandra · error · ConfigurationException

unable to locate

Error message

unable to locate ${filename}

What it means

FBUtilities.resourceToFile locates a classpath resource and returns its absolute file path. If the ClassLoader cannot find the resource, it throws ConfigurationException indicating the resource name could not be located.

Solutions

  1. Place the requested resource in the conf/ directory (or on the classpath) with the exact name expected
  2. Verify the file name/spelling and that it exists: ls conf/ and compare with the requested filename
  3. Check the process's classpath (-cp / CASSANDRA_CONF) includes the directory containing the resource

Example fix

// before
String path = FBUtilities.resourceToFile("cassandra-rackdc.properties"); // missing
// after
// ensure conf/cassandra-rackdc.properties exists and conf is on classpath
String path = FBUtilities.resourceToFile("cassandra-rackdc.properties");
Defensive patterns

Strategy: validation

Validate before calling

boolean resourceExists(String name) {
    return FBUtilities.class.getClassLoader().getResource(name) != null;
}

Try / catch

try {
    String path = FBUtilities.resourceToFile("cassandra-rackdc.properties");
} catch (ConfigurationException e) {
    log.error("Missing required classpath resource: {}", e.getMessage());
    // abort startup or fall back to defaults
}

Prevention

When it happens

Trigger: resourceToFile("cassandra-rackdc.properties") (or similar) where the file is absent from the classpath/conf directory or the name is mistyped.

Common situations: Incomplete deployments missing conf files, files renamed or moved between Cassandra versions, running with a classpath that excludes the conf directory, misconfigured snitch/property file references.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/c9c095531813eb88. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/utils/FBUtilities.java:413

                    }
                    return o2.compareTo(o1);
                }
            };
            Collections.sort(keys, comparator);
        }
        else
        {
            // unwrapped range (left < right).  standard sort is all we need.
            Collections.sort(keys);
        }
    }

    public static String resourceToFile(String filename) throws ConfigurationException
    {
        ClassLoader loader = FBUtilities.class.getClassLoader();
        URL scpurl = loader.getResource(filename);
        if (scpurl == null)
            throw new ConfigurationException("unable to locate " + filename);

        return new File(scpurl.getFile()).absolutePath();
    }

    public static File cassandraTriggerDir()
    {
        File triggerDir = null;
        if (TRIGGERS_DIR.getString() != null)
        {
            triggerDir = new File(TRIGGERS_DIR.getString());
        }
        else
        {
            URL confDir = FBUtilities.class.getClassLoader().getResource(DEFAULT_TRIGGER_DIR);
            if (confDir != null)
                triggerDir = new File(confDir.getFile());
        }
        if (triggerDir == null || !triggerDir.exists())

View on GitHub (pinned to 88fd0f6a0e)