java 1.8版
Spring5.3.5
docker中的tomcat 9
尝试在docker容器中的apache tomcat内运行spring应用程序,但spring未能初始化:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
erMapping]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: 'org.apache.commons.logging.Log
org.springframework.core.log.LogDelegateFactory.getHiddenLog(java.lang.String)' at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:225)
我已将apache commons包含在依赖项中:
plugins {
id 'war'
id 'org.springframework.boot' version '2.5.0-M2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
dependencies {
implementation group: 'org.springframework', name: 'spring-jcl', version: '5.3.5'
implementation group: 'org.springframework', name: 'spring', version: '5.3.5', ext: 'pom'
implementation group: 'org.springframework', name: 'spring-webmvc', version: '5.3.5'
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
implementation 'org.slf4j:jcl-over-slf4j:1.7.3'
implementation 'ch.qos.logback:logback-classic:1.2.3'}
我还可以在部署时看到它(这就是在tomcat9中部署后在服务器上的外观):
你知道怎么了吗?
1条答案
按热度按时间yr9zkbsy1#
好的,我希望它能帮助别人。结果这个插件把一切都搞砸了:
默认情况下,它是由spring初始化器web app添加的。我把它取下来后,一切都正常了。