CAS configuration options

116 views
Skip to first unread message

n99

unread,
Sep 14, 2019, 5:01:21 PM9/14/19
to CAS Community
Hi 

I am running cas-overlay-template version 6.0.0 on linux and have managed to build and run a docker cas with config in /etc/cas/config using standalone and dev spring profiles.

I've read the pages at


Given all the flexibility that seems available I'm confused  hat what I'm now trying to do does not seem to work.

I'm trying to provide all config files inside the war and have moved application-standalone.properties and  application-dev.properties files to inside src/main/resources in my overlay project.  I also moved the cas.properties file that was in /etc/cas/config into src/main/resources

When I now run and pass in SPRING_PROFILES_ACTIVE=standalone,qa, I can see 


2019-09-14 20:46:07,351 INFO [org.apereo.cas.web.CasWebApplication] - <The following profiles are active: standalone,qa>


but then I see an error

2019-09-14 20:47:02,591 WARN [org.apereo.cas.web.CasWebApplicationContext] - <Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'casBeanValidationPostProcessor' defined in class path resource [org/apereo/cas/config/CasCoreUtilConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'casCoreTicketsConfiguration': Unsatisfied dependency expressed through field 'casProperties'; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'cas-org.apereo.cas.configuration.CasConfigurationProperties': Could not bind properties to 'CasConfigurationProperties' : prefix=cas, ignoreInvalidFields=false, ignoreUnknownFields=false; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'cas' to org.apereo.cas.configuration.CasConfigurationProperties>


This placement of property files is something I've done in many other Spring Boot apps so am surprised it does not work.

I also tried adding 

cas.standalone.configurationDirectory=WEB-INF/classes


but get the same error.

Apologies for not being able to pick up the necessary info from the 2 pages above but it there something I am missing?

What do I need to do to ship CAS.war (not docker) with my profile property files inside the war?

Many thanks for any help.

n

Andy Ng

unread,
Sep 14, 2019, 7:46:02 PM9/14/19
to CAS Community
Hi,

Can you try out
cas.standalone.configurationDirectory=classpath:/src/resources? Can u try putting it in bootstrap.properties to see if it will works (not good practice, but can test if can work)

Also, i know you want multiple spring profiles, but just for debug sake, if you put your config in src/resources/application.properties, will it works?

As for why others spring project works, but CAS doesn't, I looked into the source code of CAS once, and it seems the properties loading is done separately other than using spring native implementation, hence the different.

see if these info helps you.

Cheer!
- Andy

nomit babraa

unread,
Sep 16, 2019, 5:47:36 AM9/16/19
to cas-...@apereo.org
Hi

Thanks for the advice

Alas

cas.standalone.configurationDirectory=classpath:/src/resources

did not work

I'll play around with the other options you mentioned and see if I can
get it working - the docs do seem to say it is possible :)

cheers

n
> --
> - 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 a topic in the Google Groups "CAS Community" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/apereo.org/d/topic/cas-user/VFlaLAvs_2U/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to cas-user+u...@apereo.org.
> To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/8506879a-2b4d-480d-8912-ac433e92d4a8%40apereo.org.



--
Nomit Babraa

Working Pattern:
Student Lifecycle Project: Monday -Wednesday AM.
CiCS: Wednesday PM - Friday.

Tel: 0114 222 1162

Andy Ng

unread,
Sep 16, 2019, 6:09:47 AM9/16/19
to CAS Community
Hi Nomit,

Sorry previous was on my phone so it is hard for me to verified the pathing, classpath:/src/resources definitely is incorrect, my bad.

The relation is:

classpath:/ = src/main/resources

So, maybe you can try setting it as:
cas.standalone.configurationDirectory=classpath:/

And put your stuff inside src/main/resources/xxxxx.properties

See if that works...

Cheers!
-Andy


nomit babraa

unread,
Sep 17, 2019, 4:34:49 AM9/17/19
to cas-...@apereo.org
Hi

Could not get it working with cas.standalone.configurationDirectory

Managed to get it working by moving ALL my properties to a
application-standalone.properties file and NOT passing in any
SPRING_PROFILES_ACTIVE or only pass in
SPRING_PROFILES_ACTIVE=standalone (the default). Then the CAS app
looks inwards and uses this file.

So it seems that you can not use adhoc profiles to load profile
properties from inside the WAR. As you say this is somewhat
inconsistent with Spring Boot default behaviour. Especially
inconsistent as the page at
https://apereo.github.io/cas/6.0.x/configuration/Configuration-Server-Management.html
says " the internal files are loaded per the spring boot rules" and
links to rules that say this is possible.

In fact the CAS page does say

"(e.g. .properties would not be loaded from classpath but
`application-.properties` would)."

It seems that only application-standalone.properties would only ever
be loaded.......?

Maybe this is a bug?

Cheers
> --
> - 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 a topic in the Google Groups "CAS Community" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/apereo.org/d/topic/cas-user/VFlaLAvs_2U/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to cas-user+u...@apereo.org.
> To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/7ca213e0-925c-49e7-92d5-6811f6cb178a%40apereo.org.

Andy Ng

unread,
Sep 17, 2019, 10:49:39 AM9/17/19
to CAS Community
Hello

Mine did work but I am using CAS 5.x, I have multiple properties in my CAS projects inside src/main/resources. 

Maybe is a CAS 6.x bug? 

- Andy

nomit babraa

unread,
Sep 18, 2019, 8:01:57 AM9/18/19
to cas-...@apereo.org
I think so.
Not sure what to do as there seems no way to raise bugs or issues.....
Cheers
n
> --
> - 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 a topic in the Google Groups "CAS Community" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/apereo.org/d/topic/cas-user/VFlaLAvs_2U/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to cas-user+u...@apereo.org.
> To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/c3150ff5-9788-4ba2-becd-618c213cf68a%40apereo.org.

Ray Bon

unread,
Sep 18, 2019, 12:28:37 PM9/18/19
to cas-...@apereo.org
'Failed to bind properties' message means that you have a property defined like 'cas.someproperty=...', but CAS does not know what 'someproperty' is. Perhaps it might be 'some.property' or a typo.

Ray
-- 
Ray Bon
Programmer Analyst
Development Services, University Systems

I respectfully acknowledge that my place of work is located within the ancestral, traditional and unceded territory of the Songhees, Esquimalt and WSÁNEĆ Nations.
Reply all
Reply to author
Forward
0 new messages