Idea 启动Sringboot 报错 Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletCont
来源:互联网 发布:pink ward知乎 编辑:程序博客网 时间:2024/06/07 21:05
问题:
idea 启动项目的时候报错(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.),
原因:
主要是以下的依赖
<dependency><groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>${springboot-version}</version>
<scope>provided</scope>
</dependency>
由于打包是不需要tomcat的,所以这里把tomcat的依赖改为provided,那么问题来了,由于idea存在一个bug,就是provided的pom不会加入classpath中,所以运行的时候就找不到tomcat相关的包,
参考:
所以这里需要两种解决办法,具体参考以下的文章http://blog.csdn.net/neosmith/article/details/50924681
解决:
在 Intellij Idea 15 中使用maven时,所有 scope 为 provided
的依赖都是不会被加入到 classpath 中的,目前该bug尚未被修复(bug report)。如果你的web应用是部署到容器中的,那么这个bug不会影响使用,因为web应用中provided
的依赖在容器运行时会被提供。如果你做Spring Boot开发,有带provided
的依赖时,直接在IDE中运行项目会导致ClassNotFound
异常。解决方案有二:
- 使用
spring-boot:run
这个 maven goal 运行程序。但这样会失去 Idea 的 debug功能,不推荐。 - 点击IDE右侧的
Maven Projects
, 找到spring-boot:run
,右键选择 debug 运行,如图:
如何调出Maven Projects
方法1.你点击一下你idea界面最左下角的那个小框,maven应该从里面找到
方法2.点击菜单栏View->Tool Windows->Maven projects
方法3.点击菜单栏Help->Find Action(Ctrl+Shift+A),输入Maven projects
- Idea 启动Sringboot 报错 Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletCont
- IDEA执行spring boot 出现Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletCont
- IDEA启动Spring Boot项目提示Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServlet...
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Spring Boot: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFa
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServlet
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
- Error : Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory
- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory Bean
- 【Spring Cloud】Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletCon
- spring boot启动报Unable to start EmbeddedWebApplicationContext问题解决方案
- SpringbootUnable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFact
- Spring-boot Unable to start EmbeddedWebApplicationContext 分析与解决方法
- Spring Boot启动报错Unable to start embedded Tomcat
- java,this不能和super同时使用 并且放在第一行
- jvm工具看内存泄露
- Eclipse安装Gradle插件
- 安卓剪裁图片(直接操作bitmap)
- 重磅消息!微信或为确保用户账户安全或关停这一功能…
- Idea 启动Sringboot 报错 Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletCont
- 关于召开“2017年BIM及智慧管理技术应用交流会(江苏)”的通知
- idea部署项目到远程tomcat——配置本地idea+远程端
- 文章标题
- JAVA的一次编译,到处运行,你知道多少?
- 【海报故事汇】一杆制胜的TopGolf
- Keras学习笔记二:卷积神经网络相关层
- 图的基本概念及其抽象数据类型
- R语言笔记