티스토리 뷰

ApplicationContextException : ServletWebServerFactory 빈이 없어서 ServletWebServerApplicationContext를 시작할 수 없습니다.

스프링 부트를 사용하여 스프링 배치 애플리케이션을 작성했습니다. 로컬 시스템에서 명령 행과 클래스 경로를 사용하여 해당 애플리케이션을 실행하려고하면 정상적으로 실행됩니다. 그러나 리눅스 서버에서 실행하려고했을 때 예외적으로 다음과 같이 표시됩니다.

 

Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.


해결법


1.application.properties에서 다음을 수행합니다.

application.properties에서 다음을 수행합니다.

spring.main.web-application-type=none

application.yml을 사용하는 경우 다음을 추가하십시오.

 spring:
    main:
      web-application-type: none
@SpringBootApplication
public class YourAppliationName extends SpringBootServletInitializer{
    public static void main(String[] args) {
        SpringApplication.run(YourAppliationName.class, args);
    }
}

YourApplicationName을 꼭 자신의 애플리케이션 네임으로 적어주어야 합니다 ~!