CAS cas-覆盖模板

CAS cas-overlay-template

花了几天时间从 https://github.com/apereo/cas-overlay-template

进行故障排除和构建 6.4.4.2

不想质疑构建过程我接受了说明并创建了我的 cas.war 文件,我立即将其部署到适当支持的 tomcat 服务器。

无论我做什么,我都不断收到以下错误,我什至尝试将适当的库添加到 tomcat 构建中。

...

    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(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)
...

不用说,即使我确实知道并清楚地看到了错误,这还是非常令人沮丧。除了“build.gradle”文件之外,是否有人能够在不修改任何内容的情况下使用他们的构建?

部署后我进入了包含所有库的目录:

-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

并注意到那里有两个版本的“spring-boot-actuator-autoconfigure-...”

嗯……好像不太对。所以我决定深入研究一下,并决定将“gradle.properties”文件从:

springBootVersion=2.6.1

springBootVersion=2.5.4

./gradlew clean build

部署到 Tomcat 并且成功了!!!

在此更改后,我们能够很快部署和启动 运行。

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

这可能是问题的根源。如果您考虑阅读在相同引用的 github 存储库中找到的 README.md 文件,您会发现:

Versions

  • CAS Server 6.5.0-SNAPSHOT
  • JDK 11

所以你的工作与6.4.4.2无关。

但是,如果您真的切换到位于此处 https://github.com/apereo/cas-overlay-template/tree/6.4 的正确分支 6.4,然后查看自述文件:

Versions

  • CAS Server 6.4.4.2
  • JDK 11

总而言之,如果您留在正确的分支上,您将获得正确的版本和 your fix is unnecessary