【问题标题】:CAS overlay with CAS Management overlay errorCAS 覆盖与 CAS 管理覆盖错误
【发布时间】:2021-01-23 08:14:16
【问题描述】:

我已经安装了tomcat-9.0.41 我构建了 cas-overlay-template 6.3 并将 cas.war 放在 webapps 中 启动服务器,一切正常。

然后我构建 cas-management-overlay 6.3 将 cas-management.war 放在 webapps 中,但是当我重新启动 tomcat 时,当 tomcat 尝试加载时出现以下错误

首先,我不明白确切的问题是什么,以及我应该如何更正该操作正在谈论的这个“类路径”。

任何帮助将不胜感激!

2021-01-22 20:39:04,641 WARN [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext] - <Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'formContentFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception; nested exception is java.lang.NoSuchMethodError: 'com.fasterxml.jackson.databind.cfg.MutableCoercionConfig com.fasterxml.jackson.dataformat.xml.XmlMapper.coercionConfigDefaults()'>
2021-01-22 20:39:04,666 ERROR [org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter] - <

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:175)

The following method did not exist:

    'com.fasterxml.jackson.databind.cfg.MutableCoercionConfig com.fasterxml.jackson.dataformat.xml.XmlMapper.coercionConfigDefaults()'

The method's class, com.fasterxml.jackson.dataformat.xml.XmlMapper, is available from the following locations:

    jar:file:/opt/cas/tomcat-9.0.41/webapps/cas-management/WEB-INF/lib/jackson-dataformat-xml-2.12.0.jar!/com/fasterxml/jackson/dataformat/xml/XmlMapper.class

The class hierarchy was loaded from the following locations:

    com.fasterxml.jackson.dataformat.xml.XmlMapper: file:/opt/cas/tomcat-9.0.41/webapps/cas-management/WEB-INF/lib/jackson-dataformat-xml-2.12.0.jar
    com.fasterxml.jackson.databind.ObjectMapper: file:/opt/cas/tomcat-9.0.41/webapps/cas-management/WEB-INF/lib/jackson-databind-2.11.3.jar
    com.fasterxml.jackson.core.ObjectCodec: file:/opt/cas/tomcat-9.0.41/webapps/cas-management/WEB-INF/lib/jackson-core-2.11.3.jar
    com.fasterxml.jackson.core.TreeCodec: file:/opt/cas/tomcat-9.0.41/webapps/cas-management/WEB-INF/lib/jackson-core-2.11.3.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of com.fasterxml.jackson.dataformat.xml.XmlMapper

【问题讨论】:

  • 你用什么编译cas-management?您的jackson-databindjackson-corejackson-dataformat-xml 的版本不兼容(参见Maven)。
  • 我只是按照 git 中的说明进行构建,所以我运行 ./gradlew clean copyCasConfiguration build 没什么特别的
  • 我将所有内容重新安装到两个具有不同域的不同 tomcat 服务器中,我从/opt/cas/apache-tomcat-9.0.41/cas/ROOT/WEB-INF/lib/jackson-* 的 cas 安装中获取 jar 文件并将它们复制到 /opt/casmgmt/apache-tomcat-9.0.41/casmgmt/ROOT/WEB-INF/lib/ 中,并且 casmgmt 服务器服务器应用程序成功启动。显然,编写叠加层源代码的人对依赖项和所有内容存在某种错误配置

标签: java tomcat cas


【解决方案1】:

我下载了最新版本,将所有内容重新安装到两个具有不同域的不同 tomcat 服务器中。毕竟是不需要的

我按照建议使用

./gradlew clean copyCasConfiguration build

错误仍然存​​在。 所以我从 cas 安装中取出了 jar 文件

/opt/cas/apache-tomcat-9.0.41/cas/ROOT/WEB-INF/lib/jackson-* 

并将它们复制到

/opt/casmgmt/apache-tomcat-9.0.41/casmgmt/ROOT/WEB-INF/lib/

并且 casmgmt 服务器服务器应用程序已成功启动。显然,编写叠加层源代码的人要么没有足够的文档来说明应该使用哪些库和版本以及何时使用,要么他们对依赖项和所有内容有某种错误配置

【讨论】:

  • Gradle 管理项目的依赖关系。也许它复制了错误的版本或者是 gradle 脚本中的错误。您遇到了库之间的轻微不匹配(2.11.32.12.0),它们几乎没有任何区别。
  • 感谢您的回复,当我将库复制过来时,我真的希望它会爆炸,毕竟看到它工作我真的很惊讶。我是一名 C 和 Perl 开发人员,所以我不得不处理 Java 之类的语言,这有点奇怪
猜你喜欢
  • 2019-09-03
  • 1970-01-01
  • 2020-02-11
  • 1970-01-01
  • 1970-01-01
  • 2014-12-07
  • 2018-07-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多