apereo/cas · error · FileNotFoundException
Resource does not exist or is unreadable
Error message
Resource does not exist or is unreadable
What it means
getResourceFrom(location) resolved the location string to a Resource, but the resource does not exist on disk/classpath/URL, or it is a file that is not readable. FileNotFoundException indicates a bad path or missing permissions rather than a malformed location string. The input at fault is the resolved location.
Solutions
- Verify the path/URL is correct and the file actually exists
- Check filesystem read permissions for the CAS process user
- For classpath resources, confirm the file is packaged in the deployed artifact
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java:171 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08).
Data as JSON: /api/errors/a8f8c5f1987b8f0b.
Report an issue: GitHub.
Appendix: source
Thrown at core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java:171
val resource = getResourceFrom(location);
return doesResourceExist(resource);
} catch (final Exception e) {
LOGGER.trace(e.getMessage());
}
return false;
}
/**
* Gets resource from a String location.
*
* @param location the metadata location
* @return the resource from
* @throws IOException the exception
*/
public static AbstractResource getResourceFrom(final String location) throws IOException {
val resource = getRawResourceFrom(location);
if (!resource.exists() || (resource.isFile() && resource.getFile().isFile() && !resource.isReadable())) {
throw new FileNotFoundException("Resource " + location + " does not exist or is unreadable");
}
return resource;
}
/**
* Export classpath resource to file.
*
* @param parentDirectory the parent directory
* @param resource the resource
* @return the resource
*/
public static @Nullable Resource exportClasspathResourceToFile(final File parentDirectory, final Resource resource) {
LOGGER.trace("Preparing classpath resource [{}]", resource);
if (resource == null) {
LOGGER.warn("No resource defined to prepare.");
return null;
}
if (!parentDirectory.exists() && !parentDirectory.mkdirs()) {View on GitHub (pinned to e7288fc434)