apereo/cas · error · RuntimeException

No groovy script cache manager is available to execute…

Error message

No groovy script cache manager is available to execute attribute mappings

What it means

WSFederationClaimsReleasePolicy tries to execute an external Groovy script file to map/release an attribute. It resolves the script through a Groovy script cache manager; when no cache manager is configured/available, the Optional is empty and the policy throws RuntimeException('No groovy script cache manager is available to execute attribute mappings').

Solutions

  1. Ensure the Groovy scripting support configuration is loaded so a script cache manager bean is registered in the application context (include the relevant groovy/core scripting module in the overlay)
  2. If you override CAS Spring configuration, do not exclude/replace the bean that provides the groovy script cache manager
  3. Alternatively, switch the attribute mapping away from external Groovy files to inline groovy/static mappings if no scripting support is desired
  4. Verify with a debug breakpoint/log that the Optional cacheMgr in the policy resolves non-null at runtime

Example fix

// before: no cache manager in context, policy throws
val policy = new WSFederationClaimsReleasePolicy(applicationContext, attributes); // groovy file mapping fails
// after: make sure scripting config is imported, e.g. in custom autoconfiguration
@Import(CasGroovyScriptCacheManagerConfiguration.class)
public class WsIdpConfig { ... }
Defensive patterns

Strategy: validation

Validate before calling

var cacheMgr = applicationContext.getBeanProvider(GroovyScriptResourceCacheManager.class)
    .getIfAvailable();
if (cacheMgr == null) {
    throw new IllegalStateException("Groovy script cache manager missing; enable scripting support before using groovy file attribute mappings");
}

Try / catch

try {
    attributes = policy.getAttributes(releasePolicyContext);
} catch (RuntimeException e) {
    if (e.getMessage().contains("No groovy script cache manager")) {
        // fall back to static attribute release or fail fast with config guidance
    }
}

Prevention

When it happens

Trigger: Mapping an attribute definition whose release policy points to an external Groovy script file (file-based groovy mapping) while the application context lacks a Groovy resource cache manager bean, so cacheMgr is absent when fetchAttributeValueFromExternalGroovyScript runs.

Common situations: WS-Federation relying-party configuration uses groovy-file attribute mappings but the module/config that supplies the script cache manager (script resource locator/cacheManager bean) is not present; running a minimal/custom CAS overlay missing the groovy scripting support wiring; wrong bean removal in a custom Spring configuration override.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08). Data as JSON: /api/errors/ac4858cc6fec3b80. Report an issue: GitHub.

Appendix: source

Thrown at support/cas-server-support-ws-idp-api/src/main/java/org/apereo/cas/ws/idp/services/WSFederationClaimsReleasePolicy.java:122

            }
        }
        mapSimpleSingleAttributeDefinition(attributeName, mappedAttributeName, attributeValue, attributesToRelease);
    }

    private static void fetchAttributeValueFromExternalGroovyScript(final String attributeName,
                                                                    final Map<String, List<Object>> resolvedAttributes,
                                                                    final Map<String, List<Object>> attributesToRelease,
                                                                    final String file) {

        ApplicationContextProvider.getScriptResourceCacheManager().ifPresentOrElse(
            cacheMgr -> {
                val script = cacheMgr.resolveScriptableResource(file, attributeName, file);
                if (script != null) {
                    fetchAttributeValueFromScript(script, attributeName, resolvedAttributes, attributesToRelease);
                }
            },
            () -> {
                throw new RuntimeException("No groovy script cache manager is available to execute attribute mappings");
            });
    }

    private static void fetchAttributeValueAsInlineGroovyScript(final String attributeName,
                                                                final Map<String, List<Object>> resolvedAttributes,
                                                                final Map<String, List<Object>> attributesToRelease,
                                                                final String inlineGroovy) {
        ApplicationContextProvider.getScriptResourceCacheManager()
            .ifPresentOrElse(
                cacheMgr -> {
                    val script = cacheMgr.resolveScriptableResource(inlineGroovy, attributeName, inlineGroovy);
                    fetchAttributeValueFromScript(script, attributeName, resolvedAttributes, attributesToRelease);
                },
                () -> {
                    throw new RuntimeException("No groovy script cache manager is available to execute attribute mappings");
                });
    }

View on GitHub (pinned to e7288fc434)