Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

简介: 自己新建的Maven 项目,然后通过修改 pom.xml 转为 Spring Boot 项目,出现此问题。启动日志如下:org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.

自己新建的Maven 项目,然后通过修改 pom.xml 转为 Spring Boot 项目,出现此问题。

启动日志如下:

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at com.wanyu.fams.App.main(App.java:15) [classes/:na]
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:189) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
	... 8 common frames omitted

错误原因:

主类没有使用 @SpringBootApplication 注解。

解决方法:

添加注解,例如:

/**
 * Hello world!
 *
 */
@SpringBootApplication
@ServletComponentScan
@Configuration
@EnableAutoConfiguration
public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        SpringApplication.run(App.class, args);
    }
}


目录
相关文章
成功解决ProxyError: Conda cannot proceed due to an error in your proxy configuration.Check for typos an
成功解决ProxyError: Conda cannot proceed due to an error in your proxy configuration.Check for typos an
成功解决ProxyError: Conda cannot proceed due to an error in your proxy configuration.Check for typos an
|
1月前
|
安全 Java 应用服务中间件
A configuration error occurred during startup.Please verify the preference field with the prompt: To
A configuration error occurred during startup.Please verify the preference field with the prompt: To
31 0
|
8月前
|
Java Spring
【Java】Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
【Java】Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
99 0
|
Java 应用服务中间件
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
报错解决:Reason: Failed to determine a suitable driver class
报错解决:Reason: Failed to determine a suitable driver class
2481 0
报错解决:Reason: Failed to determine a suitable driver class
|
并行计算 PyTorch 算法框架/工具
CUDA unknown error - this may be due to an incorrectly set up environment 问题解决
CUDA unknown error - this may be due to an incorrectly set up environment 问题解决
CUDA unknown error - this may be due to an incorrectly set up environment 问题解决
|
应用服务中间件 Android开发
a configuration error occurred during startup. place verify the preference field whth the prompt:TomcatJDK name:
a configuration error occurred during startup. place verify the preference field whth the prompt:TomcatJDK name:
115 0
a configuration error occurred during startup. place verify the preference field whth the prompt:TomcatJDK name:
|
Java
SpringBoot启动报错Unable to start EmbeddedWebApplicationContext due to missing
当启动SpringBoot时报错Unable to start EmbeddedWebApplicationContext due to missing应该如何做?本文带大家解决这个问题。
444 0
SpringBoot启动报错Unable to start EmbeddedWebApplicationContext due to missing
|
Go iOS开发
The operation couldn’t be completed. Unable to log in with account 'myappleid'. An unexpected failure occurred while logging in (Underlying error code 1100).解决方法
The operation couldn’t be completed. Unable to log in with account 'myappleid'. An unexpected failure occurred while logging in (Underlying error code 1100).解决方法
371 0