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
- Place the requested resource in the conf/ directory (or on the classpath) with the exact name expected
- Verify the file name/spelling and that it exists: ls conf/ and compare with the requested filename
- 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
- Ship all expected conf/ resources with the deployment
- Verify classpath includes the conf directory (CASSANDRA_CONF)
- Match resource names exactly to the version's expected file names
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
- a hints file cannot be configured for both compression and…
- Binlog is already configured
- Cannot locate . If this is a local file, please confirm…
- Dictionary file does not exist.
- Failed to create compressor
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)