ApplicationContextException:由于缺少 ServletWebServerFactory bean,无法启动 ServletWebServerApplicationContext [英] ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean

查看:120
本文介绍了ApplicationContextException:由于缺少 ServletWebServerFactory bean,无法启动 ServletWebServerApplicationContext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 Spring boot 编写了一个 spring 批处理应用程序.当我尝试在本地系统上使用命令行和类路径运行该应用程序时,它运行良好.但是,当我尝试在 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.

以下是我运行它的方式:

Below is the way I am running it:

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

这篇关于ApplicationContextException:由于缺少 ServletWebServerFactory bean,无法启动 ServletWebServerApplicationContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆