Search code examples
cas

CAS cas-overlay-template


Spent quite a few days troubleshooting and building 6.4.4.2 from https://github.com/apereo/cas-overlay-template

Not wanting to question the build process I accepted the instructions and created my cas.war file which I promptly deployed to the appropriately supported tomcat server.

I kept on getting the following error NO matter what I did, I even tried adding the appropriate libraries to the tomcat build.

...

    85816a86ca0b_tomcat  | Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/actuate/info/JavaInfoContributor
    85816a86ca0b_tomcat  |  at java.lang.Class.getDeclaredMethods0(Native Method) ~[?:?]
    85816a86ca0b_tomcat  |  at java.lang.Class.privateGetDeclaredMethods(Class.java:3166) ~[?:?]
    85816a86ca0b_tomcat  |  at java.lang.Class.getDeclaredMethods(Class.java:2309) ~[?:?]
    85816a86ca0b_tomcat  |  at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.3.9.jar:5.3.9]
    85816a86ca0b_tomcat  |  at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358) ~[spring-core-5.3.9.jar:5.3.9]
    85816a86ca0b_tomcat  |  at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414) ~[spring-core-5.3.9.jar:5.3.9]
    85816a86ca0b_tomcat  |  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:747) ~[spring-beans-5.3.9.jar:5.3.9]
    85816a86ca0b_tomcat  |  at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705) ~[?:?]
    85816a86ca0b_tomcat  |  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:746) ~[spring-beans-5.3.9.jar:5.3.9]
    85816a86ca0b_tomcat  |  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:685) ~[spring-beans-5.3.9.jar:5.3.9]
    85816a86ca0b_tomcat  |  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:656) ~[spring-beans-5.3.9.jar:5.3.9]
    85816a86ca0b_tomcat  |  at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1670) ~[spring-beans-5.3.9.jar:5.3.9]
    85816a86ca0b_tomcat  |  at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:570) ~[spring-beans-5.3.9.jar:5.3.9]
    85816a86ca0b_tomcat  |  at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:542) ~[spring-beans-5.3.9.jar:5.3.9]
    85816a86ca0b_tomcat  |  at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:238) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
    85816a86ca0b_tomcat  |  at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:231) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
    85816a86ca0b_tomcat  |  at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:221) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
    85816a86ca0b_tomcat  |  at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:169) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
    85816a86ca0b_tomcat  |  at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:129) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
    85816a86ca0b_tomcat  |  at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-2.5.4.jar:2.5.4]
    85816a86ca0b_tomcat  |  ... 46 more
    85816a86ca0b_tomcat  | Caused by: java.lang.ClassNotFoundException: org.springframework.boot.actuate.info.JavaInfoContributor
    85816a86ca0b_tomcat  |  at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1407) ~[catalina.jar:9.0.56]
    85816a86ca0b_tomcat  |  at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1215) ~[catalina.jar:9.0.56]
    85816a86ca0b_tomcat  |  at java.lang.Class.getDeclaredMethods0(Native Method)
...

Needless to say it was quite frustrating even when I do know and see the error clearly. Was anyone able to use their build without modifying anything other than the "build.gradle" file?


Solution

  • Spent quite a few days troubleshooting and building 6.4.4.2 from https://github.com/apereo/cas-overlay-template

    This is likely the root of the problem. If you consider reading the README.md file found at the very same referenced github repository, you will find:

    Versions

    • CAS Server 6.5.0-SNAPSHOT
    • JDK 11

    So what you are working with has nothing to do with 6.4.4.2.

    However, if you do actually switch to the correct branch, 6.4, located here https://github.com/apereo/cas-overlay-template/tree/6.4 and then review the README file:

    Versions

    • CAS Server 6.4.4.2
    • JDK 11

    In summary, if you stay on the right branch, you will get the correct version and your fix is unnecessary.