org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at com.example.demo.HelloWorldController.main(HelloWorldController.java:15) [classes/:na]
Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:203) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
... 8 common frames omitted Process finished with exit code 1

解决办法:

1. 在pom.xml中必须添加依赖

  <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

2.启动类上必须添加注解@Controller

3.启动类上必须添加注解@EnableAutoConfiguration 或 @SpringBootApplication

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplic的更多相关文章

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

    SpringBoot启动时的异常信息如下: "C:\Program Files\Java\jdk1.8.0_161\bin\java" ......... com.fangxing ...

  2. 【转载】springboot启动报错(Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWe)

    SpringBoot启动时的异常信息如下: 1 "C:\Program Files\Java\jdk1.8.0_161\bin\java" ......... com.fangxi ...

  3. Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFa

    Springboot通过application启动报错 2019-01-25 14:02:33.810 ERROR [restartedMain] org.springframework.boot.S ...

  4. Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to ;XX.XX.XX.XX:6379] with root cause

    java.net.ConnectException: Connection refused: no further information at sun.nio.ch.SocketChannelImp ...

  5. spring boot 开发 org.springframework.context.ApplicationContextException: Unable to start web server;

    Error starting ApplicationContext. To display the conditions report re-run your application with 'de ...

  6. nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.报错解决

    近期在学springboot,学的时候遇到这个错,网上查了好多,改了不行,后来发现自己的配置类没有加@SpringBootApplication注解 Exception encountered dur ...

  7. Spring boot多模块(moudle)中的一个注入错误(Unable to start embedded container; nested exception is org)

    org.springframework.context.ApplicationContextException: Unable to start embedded container; nested ...

  8. org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: Unknown column 'viewpoint' in 'field list'

    问题描述:当我在model中添加了一下代码以后数据库报错: 添加的代码为: private Viewpoint viewpoint; public Viewpoint getViewpoint() { ...

  9. nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException

    You should autowire interface AbstractManager instead of class MailManager. If you have different im ...

随机推荐

  1. Python 第三天学习整理①

    今天学习的内容包括以下几个方面:1.字符编码 2.文件操作 3.函数 1.字符编码 关于字符编码,关注以下几个点 1.1 什么是字符编码 字符编码:字符转化为数字的过程所遵循的标准 字符编码包括:un ...

  2. 转载 Log4j2在WEB项目中配置

    最近决定在新WEB项目中使用新的日志系统Log4j2. 官方介绍和学习文档网址为http://logging.apache.org/log4j/2.x/ 首先在WEB项目中引入以下几个jar包: ① ...

  3. C++11之列表初始化

    1. 在C++98中,标准允许使用花括号{}来对数组元素进行统一的集合(列表)初始化操作,如:int buf[] = {0};int arr[] = {1,2,3,4,5,6,7,8}; 可是对于自定 ...

  4. MTD系统架构和yaffs2使用、Nandflash驱动设计

    一.MTD系统架构 1.MTD设备体验 FLASH在嵌入式系统中是必不可少的,它是bootloader.linux内核和文件系统的最佳载体. 在Linux内核中引入了MTD子系统为NORFLASH和N ...

  5. hdu 4826 Labyrinth(简单dp)

    Description 度度熊是一只喜欢探险的熊,一次偶然落进了一个m*n矩阵的迷宫,该迷宫只能从矩阵左上角第一个方格开始走,只有走到右上角的第一个格子才算走出迷宫,每一次只能走一格,且只能向上向下向 ...

  6. delphi 判断WIN8 , WIN8.1 , WIN10 系统版本

    今天测试了WIN8, WIN8.1, WIN10 系统下GetVersionEx 函数,居然取出来的版本都是6.2 . 于是网上查找各种获取内核版本号的方法, 终于找到几种有用的方法, 记录下来以作备 ...

  7. bash: service: command not found 错误的解决方法

    service命令是要用ROOT用户来执行的,而出错的用户是用su root切换到ROOT用户下,这个命令没有也不会把环境带过去! 用如下命令就不会出错了:su - root 注意:su 后面是一个空 ...

  8. 【Java架构:基础技术】一篇文章搞掂:Idea

    一.使用技巧 1.1.配置Maven 打开File-Settings打开设置界面 1.2.配置JDK JDK可以设置默认版本,也可以设置针对某个项目 分别对应File-Other Setting-De ...

  9. (转)Ubuntu 12.04 下安装 Eclipse

    转:http://hi.baidu.com/sanwer/item/e5328bcdf2beaa27a1b50a0f 方法一:(缺点是安装时附加openjdk等大量程序并无法去除,优点是安装简单) $ ...

  10. MySql中4种批量更新的方法update table2,table1,批量更新用insert into ...on duplicate key update, 慎用replace into.

    mysql 批量更新记录 MySql中4种批量更新的方法最近在完成MySql项目集成的情况下,需要增加批量更新的功能,根据网上的资料整理了一下,很好用,都测试过,可以直接使用. mysql 批量更新共 ...