SpringBoot部署问题

红中 2015-05-21 09:58:23
最近研究springboot结果放到Myeclipse上就出问题了。大家有没有遇到过?
只是个简单的程序,pom.xml配置如下:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.paybay</groupId>
<artifactId>SpringBootSample</artifactId>
<version>1.0</version>
<name>SpringBootSample</name>
<description/>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.6</java.version>
<tomcat.version>7.0.55</tomcat.version>
</properties>
<build>
<plugins>
<!-- 如果是通过parent方式继承spring-boot-starter-parent则不用此插件
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
-->
</plugins>
</build>
<!-- 父依赖 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.4.RELEASE</version>
</parent>
<dependencies>
<dependency>
<!-- 导入jar包 -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>

遇到的错误:
ERROR 3816 --- [ main] o.s.boot.SpringApplication : Application startup failed

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:135)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
at cn.paybay.EasyApp.main(EasyApp.java:24)
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:185)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:132)
... 7 common frames omitted

Exception in thread "main" 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:135)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
at cn.paybay.EasyApp.main(EasyApp.java:24)
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:185)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:132)
... 7 more
...全文
41673 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
axiaoming 2017-12-13
  • 打赏
  • 举报
回复
引用 13 楼 LinFord1995 的回复:
12楼正解+1
官网的例子有那个配置 https://github.com/spring-projects/spring-boot/blob/master/spring-boot-samples/spring-boot-sample-traditional/pom.xml#L32:36
axiaoming 2017-12-13
  • 打赏
  • 举报
回复
https://github.com/spring-projects/spring-boot/blob/master/spring-boot-samples/spring-boot-sample-traditional/pom.xml#L32:36
LinFord1995 2017-09-15
  • 打赏
  • 举报
回复
@EnableCaching没有和@Cacheable(“books”)一起使用,要不然在application启动类中把这个注解去掉(反正我是这样解决的),报这个错误主要是注解错误的问题,每个人的注解情况都不一样,一个一个去排除吧
LinFord1995 2017-09-15
  • 打赏
  • 举报
回复
12楼正解+1
丿明月丶夜 2017-09-14
  • 打赏
  • 举报
回复
正解应该是 <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <scope>compile</scope> // 不打包的时候用,打包的时候注释 <!--<scope>provided</scope>--> // 打包的时候用,不打包的时候注释 </dependency>
qq_26893687 2017-07-12
  • 打赏
  • 举报
回复
引用 6 楼 jiaobuchong 的回复:
lack container, 我也遇到了这个问题, 我的情况是:

    <!-- 使用嵌入式Jetty作为web container -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
出现了这个异常, 只要再pom文件里加上对应的 container deps:

     <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
就可以了。
用了你这个之后 错误更多了 卧槽.................
Balalalalalalalala 2017-07-12
  • 打赏
  • 举报
回复
报了什么错 一个个解决啊!
  • 打赏
  • 举报
回复
原来: <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> </dependency> <dependency> 改成: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>1.3.1.RELEASE</version> </dependency>
大壮vip 2017-06-02
  • 打赏
  • 举报
回复
加上@SpringBootApplication还是不行呢?
Vin__ 2017-04-11
  • 打赏
  • 举报
回复
引用 1 楼 huoyexiangyu 的回复:
你在Spring Boot的入口类加上@SpringBootApplication就行了
谢谢
Balalalalalalalala 2016-06-05
  • 打赏
  • 举报
回复
lack container, 我也遇到了这个问题, 我的情况是:

    <!-- 使用嵌入式Jetty作为web container -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
出现了这个异常, 只要再pom文件里加上对应的 container deps:

     <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
就可以了。
红中 2016-05-27
  • 打赏
  • 举报
回复
好像是jar包冲突还是什么的,后来怎么解决的忘记了....汗
qq_25832593 2015-12-30
  • 打赏
  • 举报
回复
这个问题是没有引入spring_boot_starter_web依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>1.3.1.RELEASE</version> </dependency>
hank1247 2015-11-05
  • 打赏
  • 举报
回复
这个问题你是怎么解决的?我也遇到了
迷林 2015-08-05
  • 打赏
  • 举报
回复
ApplicationContext 没启动
  • 打赏
  • 举报
回复
你在Spring Boot的入口类加上@SpringBootApplication就行了

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧