Spring Boot + Java 8을 사용하고 있습니다. REST 리소스를 추가하고 기본 구성이 올바른지 테스트하려고합니다.
하지만 Spring Boot 애플리케이션을 시작하는 동안 문제가 발생했습니다. 아래 로그를 찾으십시오.
021-01-15 00:19:53.320 WARN 22065 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.NoSuchMethodError: org.apache.tomcat.util.ExceptionUtils.preload()V
2021-01-15 00:19:53.329 INFO 22065 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-01-15 00:19:53.347 ERROR 22065 --- [ main] o.s.b.d.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:
org.apache.catalina.startup.Tomcat.<init>(Tomcat.java:183)
The following method did not exist:
org.apache.tomcat.util.ExceptionUtils.preload()V
The method's class, org.apache.tomcat.util.ExceptionUtils, is available from the following locations:
jar:file:/home/xyz/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-runner/9.3.20.v20170531/56d1d067b4e42a6c603ece754534f9a65211924a/jetty-runner-9.3.20.v20170531.jar!/org/apache/tomcat/util/ExceptionUtils.class
jar:file:/home/xyz/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/9.0.41/a43e9711e85073187d04b137882b4b7957180ef0/tomcat-embed-core-9.0.41.jar!/org/apache/tomcat/util/ExceptionUtils.class
The class hierarchy was loaded from the following locations:
org.apache.tomcat.util.ExceptionUtils: file:/home/xyz/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-runner/9.3.20.v20170531/56d1d067b4e42a6c603ece754534f9a65211924a/jetty-runner-9.3.20.v20170531.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.apache.tomcat.util.ExceptionUtils
나는 바람둥이를 제외하려고 시도했지만 여전히 같은 문제가 발생했습니다.
아래 내 Gradle 설정을 살펴보십시오.
plugins {
id 'org.springframework.boot' version '2.4.1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
group = 'com.hive'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
configurations {
all*.exclude module: 'log4j'
all*.exclude module: 'log4j-core'
all*.exclude module: 'slf4j-log4j12'
all*.exclude module: 'log4j-slf4j-impl'
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.7.0'
compile group: 'org.apache.hive', name: 'hive-jdbc', version: '3.1.2'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
위의 의존성 문제를 해결하기 위해 몇 가지 해결책을 제안하십시오.