Hello everybody, 

the thing is that SpringBoot comes along if the SpringCloud configuration 
which basically creates two application context initialisation steps after 
server startup (independent if SpringCloud config is deactivated or not => 
).

The application.properties no matter where they are defined will be loaded 
in the second bootstrap step. But the CasConfigurationProperties will be 
loaded with the first Application Context - and the properties are not 
available here.

So what I did is to move to SpringBoot 2.7.14 and changed the file names to 
bootstrap-<profile>.properties.
Now the properties will be used for both initialisations. 

I am not a Spring expert. This is what I found while debugging.

Best regards,
Conrad









On Friday, July 28, 2023 at 10:05:23 AM UTC+2 [email protected] wrote:

> Hi Ray,
>
> We are upgrading, from 6.4.3, the props have been working in these 
> locations.
>
> After a day of debugging it turned out that there is some race condition 
> in spring boot about app context creation. Upgrading to springboot to 
> 2.7.14 seems to solve it.
>
> Have a good one
>
> Martin
>
> On Thursday, July 27, 2023 at 9:16:23 PM UTC+2 Ray Bon wrote:
>
>> Martin,
>>
>> This logger may help:
>>
>> <AsyncLogger name="org.apereo.cas.config" level="debug" />
>>
>> I also have this line in my log output:
>> cas | 2023-07-27 19:10:08,677 INFO [ 
>> org.aper.cas.util.io.PathWatcherService] - <Watching directory path at 
>> [/etc/cas/config]> [main]
>>
>> Check to make sure it is looking in the correct place for 
>> management.properties (even though /etc/cas/config is the default).
>>
>> Ray
>>
>> On Thu, 2023-07-27 at 09:17 -0700, '[email protected]' via CAS 
>> Community wrote:
>>
>> Notice: This message was sent from outside the University of Victoria 
>> email system. Please be cautious with links and sensitive information.
>>
>>
>> Hi cas-users, 
>>
>> We generated a minimal cas-management overlay using
>>  
>> curl "
>> https://casinit.herokuapp.com/starter.tgz?artifactId=cas&casVersion=6.6.3&commandlineShellSupported=false&dependencies=support-mongo-service-registry&deploymentType=executable&description=WAR%20overlay%20to%20use%20as%20a%20starting%20template%20for%20Apereo%20CAS%20deployments.&dockerSupported=false&githubActionsSupported=false&groupId=org.apereo.cas&helmSupported=false&herokuSupported=false&javaVersion=11&language=java&name=cas&nativeImageSupported=false&packageName=org.apereo&packaging=war&puppeteerSupported=false&type=cas-management-overlay&version=1.0.0";
>>  
>> | tar -xzvf -
>>
>> Setting cas.service-registry.mongo.client-uri=mongodb://localhost/somedb 
>> in etc/cas/config/management.properties
>>
>> results in 
>>
>> Caused by: java.lang.IllegalArgumentException: The connection string is 
>> invalid. Connection strings must start with either 'mongodb://' or 
>> 'mongodb+srv://
>>         at com.mongodb.ConnectionString.<init>(ConnectionString.java:303) 
>> ~[mongodb-driver-core-4.7.1.jar!/:?]
>>         at 
>> org.apereo.cas.mongo.MongoDbConnectionFactory.mongoDbFactory(MongoDbConnectionFactory.java:191)
>>  
>> ~[cas-server-support-mongo-core-6.6.0.jar!/:6.6.0]
>>         at 
>> org.apereo.cas.mongo.MongoDbConnectionFactory.buildMongoTemplate(MongoDbConnectionFactory.java:287)
>>  
>> ~[cas-server-support-mongo-core-6.6.0.jar!/:6.6.0]
>>         at 
>> org.apereo.cas.config.MongoDbServiceRegistryConfiguration.mongoDbServiceRegistryTemplate(MongoDbServiceRegistryConfiguration.java:50)
>>  
>> ~[cas-server-support-mongo-service-registry-6.6.0.jar!/:6.6.10]
>>
>> No matter how we try, the mandatory db config value are never getting 
>> bound to CasConfigurationProperties. 
>>
>> But, actually we are able to start cas-management using system 
>> properties: 
>>
>> java -Dcas.service-registry.mongo.client-uri=mongodb://localhost/somedb 
>> -jar build/libs/cas-management.war
>>
>> Is this a known problem?
>>
>> Where and how should cas.service-registry.mongo.client-uri be set using a 
>> properties file?
>>
>> Regards
>>
>> Martin
>>
>>
>>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/f94f67b0-1c01-43d5-b6f5-e3e172652f86n%40apereo.org.

Reply via email to