Daniel Maldonado
Daniel Maldonado

Reputation: 311

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?

Upvotes: 1

Views: 1310

Answers (2)

Misagh Moayyed
Misagh Moayyed

Reputation: 4318

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.

Upvotes: 2

Daniel Maldonado
Daniel Maldonado

Reputation: 311

After deployment I went into the directory that contained all the libraries:

-rw-r----- 1 root root   1391480 Jan  6 15:53 spring-boot-2.5.4.jar
-rw-r----- 1 root root    644836 Jan  6 15:53 spring-boot-actuator-2.5.4.jar
-rw-r----- 1 root root    534699 Jan  6 16:14 spring-boot-actuator-autoconfigure-2.5.4.jar
-rw-r----- 1 root root    561010 Jan  6 16:16 spring-boot-actuator-autoconfigure-2.6.1.jar
-rw-r----- 1 root root   1564883 Jan  6 15:53 spring-boot-autoconfigure-2.5.4.jar
-rw-r----- 1 root root     27774 Jan  6 15:53 spring-boot-configuration-metadata-2.5.4.jar

and noticed there where two versions of "spring-boot-actuator-autoconfigure-..."

Hmmm... that did not seem right. So I decided to dig around a bit and decided to change the "gradle.properties" file from:

springBootVersion=2.6.1

to

springBootVersion=2.5.4

./gradlew clean build

Deployed to Tomcat and it WORKED!!!

We were able to deploy and get up and running pretty quickly after this change.

Upvotes: 0

Related Questions