{"record":{"id":"f3f917a118dc7b06","repo":"apereo/cas","slug":"registered-service-has-expired-on","errorCode":null,"errorMessage":"Registered service [{}] has expired on [{}]","messagePattern":"Registered service \\[(.+?)\\] has expired on \\[(.+?)\\]","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"core/cas-server-core-services-registry/src/main/java/org/apereo/cas/services/mgmt/AbstractServicesManager.java","lineNumber":487,"sourceCode":"        @Nullable final RegisteredService registeredService) {\n        val result = checkServiceExpirationPolicyIfAny(registeredService);\n        if (validateAndFilterServiceByEnvironment(result)) {\n            return result;\n        }\n        return null;\n    }\n\n    private @Nullable RegisteredService checkServiceExpirationPolicyIfAny(\n        @Nullable final RegisteredService registeredService) {\n        if (registeredService == null || RegisteredServiceAccessStrategyUtils.ensureServiceIsNotExpired(registeredService)) {\n            return registeredService;\n        }\n        return processExpiredRegisteredService(registeredService);\n    }\n\n    private @Nullable RegisteredService processExpiredRegisteredService(final RegisteredService registeredService) {\n        val policy = registeredService.getExpirationPolicy();\n        LOGGER.warn(\"Registered service [{}] has expired on [{}]\", registeredService.getServiceId(), policy.getExpirationDate());\n        val clientInfo = ClientInfoHolder.getClientInfo();\n        if (policy.isNotifyWhenExpired()) {\n            LOGGER.debug(\"Contacts for registered service [{}] will be notified of service expiry\", registeredService.getServiceId());\n            publishEvent(new CasRegisteredServiceExpiredEvent(this, registeredService, false, clientInfo));\n        }\n        if (policy.isDeleteWhenExpired()) {\n            LOGGER.debug(\"Deleting expired registered service [{}] from registry.\", registeredService.getServiceId());\n            if (policy.isNotifyWhenDeleted()) {\n                LOGGER.debug(\"Contacts for registered service [{}] will be notified of service expiry and removal\",\n                    registeredService.getServiceId());\n                publishEvent(new CasRegisteredServiceExpiredEvent(this, registeredService, true, clientInfo));\n            }\n            delete(registeredService);\n            return null;\n        }\n        return registeredService;\n    }\n","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/core/cas-server-core-services-registry/src/main/java/org/apereo/cas/services/mgmt/AbstractServicesManager.java#L469-L505","documentation":"AbstractServicesManager periodically evaluates each registered service's expiration policy (checkServiceExpirationPolicyIfAny). When the expiration date has passed, processExpiredRegisteredService logs a warning and, per policy flags, notifies contacts (publishing CasRegisteredServiceExpiredEvent) and/or deletes the service from the registry. The message itself is informational: the service is expired as of the policy's expiration date.","triggerScenarios":"ServicesManager's scheduled expiration check finds registeredService.getExpirationPolicy().isExpired() true — the service definition carries an expirationDate earlier than now, with optional notifyWhenExpired/deleteWhenExpired flags controlling downstream behavior.","commonSituations":"Service definitions imported from another environment carried stale expiration dates; a temporary service was never extended; clock skew between nodes; admins unaware that deleteWhenExpired=true silently removed services from the registry.","solutions":["Update or remove the expirationDate in the service's expiration policy (or set a future date) if the service should remain active","Set notifyWhenExpired=true to alert service contacts before/upon expiry","Check whether deleteWhenExpired=true removed the service from the registry and restore it if deletion was unintended","Verify server clocks/NTP to rule out false expiry from skew"],"exampleFix":"// before: service expired\n// \"expirationPolicy\":{\"@class\":\"...ServiceTimeBasedExpirationPolicy\",\"expirationDate\":\"2025-01-01\"}\n// after: extend expiration\n// \"expirationPolicy\":{\"@class\":\"...ServiceTimeBasedExpirationPolicy\",\"expirationDate\":\"2027-01-01\",\"notifyWhenExpired\":true}","handlingStrategy":"validation","validationCode":"RegisteredServiceExpirationPolicy p = service.getExpirationPolicy();\nif (p != null && p.isExpired()) {\n    LOGGER.warn(\"Service {} expires/is expired on {}\", service.getName(), p.getExpirationDate());\n}","typeGuard":"boolean expiringSoon(RegisteredService s, java.time.LocalDate threshold) {\n    return s.getExpirationPolicy() instanceof RegisteredServiceTimeBasedExpirationPolicy t\n        && t.getExpirationDate() != null && t.getExpirationDate().isBefore(threshold);\n}","tryCatchPattern":null,"preventionTips":["Audit expiration dates when importing service definitions between environments","Enable notifyWhenExpired so contacts get warned before deletion","Avoid deleteWhenExpired=true on long-lived services","NTP-sync all nodes to prevent premature expiry"],"tags":["service-expiration","service-registry","lifecycle","scheduled-task"],"backgroundTag":"resource-not-found","analyzedSha":"e7288fc434b4f4505b8452e1a57e8fb3111bb863","analyzedAt":"2026-09-08T15:39:16.015Z","contentChangedAt":"2026-09-08T15:39:16.015Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}