ApplicationContextException:由于缺少ServletWebServerFactory bean而无法启动ServletWebServerApplicationContext

问题描述:

我已经使用Spring Boot编写了Spring Batch应用程序.当我尝试在本地系统上使用命令行和类路径运行该应用程序时,它运行良好.但是,当我尝试在linux服务器上运行它时,却出现以下异常

I have written a spring batch application using Spring boot. When I am trying to run that application using command line and classpath on my local system it is running fine. However, when I tried to run it on linux server it is giving me following exception

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

以下是我的运行方式:

java -cp jarFileName.jar; lib\* -Dlogging.level.org.springframework=DEBUG -Dspring.profiles.active=dev -Dspring.batch.job.names=abcBatchJob com.aa.bb.StartSpringBatch > somelogs.log

解决方案是:

我在application.yml文件中将以下属性明确设置为none.

I explicitly set the below property to none in application.yml file.

spring:
  main:
    web-application-type: none