05-Apr-2021 15:38:25.517 INFO [java-sdk-http-connection-reaper] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [ch.qos.logback.classic.spi.ThrowableProxy]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [ch.qos.logback.classic.spi.ThrowableProxy]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1372)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1360)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1219)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:119)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:419)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
at ch.qos.logback.classic.Logger.log(Logger.java:765)
at org.apache.commons.logging.LogAdapter$Slf4jLocationAwareLog.debug(LogAdapter.java:470)
at com.amazonaws.http.IdleConnectionReaper.run(IdleConnectionReaper.java:190)
위와 같은 오류가 발생 할 경우 tomcat destroy 시 logback을 종료시키는 코드를 넣어주어야 합니다.
import ch.qos.logback.classic.LoggerContext;
import org.slf4j.LoggerFactory;
public class ShutdownHookConfiguration {
public void destroy() {
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
loggerContext.stop();
}
}
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
@Bean(destroyMethod = "destroy")
public ShutdownHookConfiguration shutdownHookConfiguration() {
return new ShutdownHookConfiguration();
}
}
'IT > Spring' 카테고리의 다른 글
[SpringBoot] H2 데이터베이스 사용하기 (0) | 2021.06.17 |
---|---|
[SpringBoot] 이메일 전송 (Gmail SMTP Server) (2) | 2021.04.30 |
[SpringBoot] destroy event 등록하기 (0) | 2021.04.05 |
[Spring Boot] 간단하게 @Scheduled 사용하기 (0) | 2021.03.31 |
[Spring Boot] thymeleaf 사용방법 (2) | 2021.02.15 |