Extraneous(?) incorrect(?) warning in cas.log when using MongoDB service registry

68 views
Skip to first unread message

David Curry

unread,
Dec 21, 2017, 2:48:05 PM12/21/17
to cas-...@apereo.org

So this week I've been experimenting with the MongoDB service registry instead of the JSON service registry. Everything seems to be working correctly, including using cas.serviceRegistry.initFromJson to copy the JSON service registry entries into the MongoDB service registry. So that's all good.

The only issue I have is that I'm seeing this warning message in cas.log:

2017-12-21 13:39:46,160 WARN [org.apereo.cas.config.CasCoreServicesConfiguration] - <Runtime memory is used as the persistence storage for retrieving and persisting service definitions. Changes that are made to service definitions during runtime WILL be LOST upon container restarts. Ideally for production, you need to choose a storage option (JDBC, etc) to store and track service definitions.>

It's coming from cas/core/cas-server-core-services/src/main/java/org/apereo/cas/config/CasCoreServicesConfiguration.java:

@ConditionalOnMissingBean(name = "serviceRegistryDao")
@Bean
@RefreshScope
public ServiceRegistryDao serviceRegistryDao() {
    LOGGER.warn("Runtime memory is used as the persistence storage for retrieving and persisting service definitions. "
        + "Changes that are made to service definitions during runtime WILL be LOST when the web server is restarted. "
        + "Ideally for production, you need to choose a storage option (JDBC, etc) to store and track service definitions.");
...

But if I'm understanding the annotations above correctly, that bean should only be getting created if it doesn't already exist. And over in cas/support/cas-server-support-mongo-service-registry/src/main/java/org/apereo/cas/config/MongoDbServiceRegistryConfiguration.java we have:

@Bean
public ServiceRegistryDao serviceRegistryDao() {
    final MongoDbServiceRegistryProperties mongo = casProperties.getServiceRegistry().getMongo();
    return new MongoServiceRegistryDao(
            mongoDbServiceRegistryTemplate(),
            mongo.getCollection());
}

which would presumably satisfy the "there should be a serviceRegistryDao bean" condition, thereby preventing the warning. But I'm not much of a Java (especially Java EE) developer though, so my understanding of all the magic behind annotations is limited to non-existent, so maybe I'm wrong. 

But with DEBUG logging turned on, I see that the services from the MongoDB service registry are "there," so the MongoDB service registry is definitely getting instantiated:

2017-12-21 14:35:54,220 DEBUG [org.apereo.cas.services.AbstractServicesManager] - <Adding registered service [https://casdev.newschool.edu/cas/idp/profile/SAML2/Callback.+]>
2017-12-21 14:35:54,220 DEBUG [org.apereo.cas.services.AbstractServicesManager] - <Adding registered service [^https://casdev-casapp.newschool.edu/secured-by-cas(\z|/.*)]>
2017-12-21 14:35:54,221 DEBUG [org.apereo.cas.services.AbstractServicesManager] - <Adding registered service [https://casdev-samlsp.newschool.edu/shibboleth]>
2017-12-21 14:35:54,221 DEBUG [org.apereo.cas.services.AbstractServicesManager] - <Adding registered service [^https://casdev-casapp.newschool.edu/return-mapped(\z|/.*)]>
2017-12-21 14:35:54,221 DEBUG [org.apereo.cas.services.AbstractServicesManager] - <Adding registered service [^https://casdev-casapp.newschool.edu/secured-by-cas-duo(\z|/.*)]>
2017-12-21 14:35:54,221 DEBUG [org.apereo.cas.services.AbstractServicesManager] - <Adding registered service [^https://casdev.newschool.edu/cas/status/dashboard(\z|/.*)]>
2017-12-21 14:35:54,221 DEBUG [org.apereo.cas.services.AbstractServicesManager] - <Adding registered service [^https://casdev.newschool.edu/cas-management(\z|/.*)]>
2017-12-21 14:35:54,221 INFO [org.apereo.cas.services.AbstractServicesManager] - <Loaded [7] service(s) from [MongoServiceRegistryDao].>

And if the MongoDB service registry is "there," then that error message should not be appearing.

This is with CAS-5.2.1-SNAPSHOT, built this morning. The only service registry related properties in cas.properties are:

cas.serviceRegistry.mongo.clientUri:    ${mongo.uri}
cas.serviceRegistry.mongo.collection:   casServiceRegistry

Is anyone else using the MongoDB service registry (or any other service registry) and seeing this? Am I doing something wrong or missing some configuration property? Or did I find a bug?

Thanks,
--Dave

--

DAVID A. CURRY, CISSP
DIRECTOR OF INFORMATION SECURITY
INFORMATION TECHNOLOGY

71 FIFTH AVE., 9TH FL., NEW YORK, NY 10003
+1 212 229-5300 x4728david...@newschool.edu

The New School

Reply all
Reply to author
Forward
0 new messages