apereo/cas · warning
Could not retrieve input stream from resource. Moving on...
Error message
Could not retrieve input stream from resource. Moving on...
What it means
The MDUI metadata loader could not obtain an input stream for a metadata resource (or parsing threw), caught the exception, logged this warning with the cause, and skipped the resource by returning an empty list.
Solutions
- Read the full stack trace attached by LoggingUtils.warn to identify root cause (IO vs parse).
- Verify the resource path/URL is correct and accessible from the CAS process user.
- Test the URL with curl (status code, content) or the file with an XML validator.
- Fix file permissions (chmod/chown) or network/firewall egress for remote metadata.
Example fix
// before (unreachable URL) metadata: https://internal.invalid/idp-metadata.xml // after metadata: file:/etc/cas/mdui/idp-metadata.xml
Defensive patterns
Strategy: try-catch
Validate before calling
try (var in = new FileInputStream(path)) {
// ensure readable before handing to resolver
} catch (IOException e) {
LOGGER.error("Metadata unreadable: {}", path, e);
} Try / catch
try {
loadMetadata(resource);
} catch (Exception e) {
LOGGER.warn("Could not load metadata resource {}", resource, e);
// continue with remaining resources
} Prevention
- Check file permissions and paths for all MDUI metadata resources at deployment.
- Curl-test remote metadata URLs from the CAS host.
- Validate metadata XML against the SAML schema before deployment.
When it happens
Trigger: getResourceInputStream(resource, entityId) throws (resource missing, unreadable, URL unreachable) or ParserPool.parse fails inside loadMetadataFromResource — the generic catch logs "Could not retrieve input stream from resource. Moving on...".
Common situations: File path typo or missing permissions; HTTP metadata URL returning 404/403/DNS failure; malformed XML that the parser rejects; container lacking network egress.
Understand the failure class
Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.
Related errors
- Skipping metadata [ ]; Either the resource cannot be…
- The service definition file could not be saved at
- Cannot read/load from subordinate directory
- No assertion consumer service could be found for entity
- Endpoint for is not available or does not define a binding…
AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08).
Data as JSON: /api/errors/a6cc4e71a8b13e5f.
Report an issue: GitHub.
Appendix: source
Thrown at support/cas-server-support-saml-mdui-core/src/main/java/org/apereo/cas/support/saml/mdui/AbstractMetadataResolverAdapter.java:119
LOGGER.debug("Locating metadata resource from input stream.");
if (!resource.exists() || !resource.isReadable()) {
throw new FileNotFoundException("Resource does not exist or is unreadable");
}
return resource.getInputStream();
}
private List<MetadataResolver> loadMetadataFromResource(final MetadataFilter metadataFilter, final Resource resource,
final String entityId) {
LOGGER.debug("Evaluating metadata resource [{}]", resource.getFilename());
try (val in = getResourceInputStream(resource, entityId)) {
if (in.available() > 0) {
LOGGER.debug("Parsing [{}]", resource.getFilename());
val document = this.configBean.getParserPool().parse(in);
return buildSingleMetadataResolver(metadataFilter, resource, document);
}
LOGGER.warn("Input stream from resource [{}] appears empty. Moving on...", resource.getFilename());
} catch (final Exception e) {
LoggingUtils.warn(LOGGER, "Could not retrieve input stream from resource. Moving on...", e);
}
return new ArrayList<>();
}
/**
* Build single metadata resolver.
*
* @param metadataFilterChain the metadata filters chained together
* @param resource the resource
* @param document the xml document to parse
* @return list of resolved metadata from resources.
*/
private List<MetadataResolver> buildSingleMetadataResolver(final MetadataFilter metadataFilterChain, final Resource resource,
final Document document) {
val metadataRoot = document.getDocumentElement();
val metadataProvider = new DOMMetadataResolver(metadataRoot);
metadataProvider.setParserPool(this.configBean.getParserPool());
metadataProvider.setFailFastInitialization(true);View on GitHub (pinned to e7288fc434)