zoukankan      html  css  js  c++  java
  • 解决springboot启动失败问题:Unable to start embedded container;

    全部报错内容如下:

    org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.IllegalStateException: Expected method not found: java.lang.NoSuchMethodException: org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.addApplicationListener(org.apache.catalina.deploy.ApplicationListener)
    	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at com.springboot5.App.main(App.java:12) [classes/:na]
    Caused by: java.lang.IllegalStateException: Expected method not found: java.lang.NoSuchMethodException: org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.addApplicationListener(org.apache.catalina.deploy.ApplicationListener)
    	at org.springframework.util.ClassUtils.getMethod(ClassUtils.java:628) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    	at org.springframework.boot.autoconfigure.websocket.TomcatWebSocketContainerCustomizer.addListener(TomcatWebSocketContainerCustomizer.java:86) ~[spring-boot-autoconfigure-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.autoconfigure.websocket.TomcatWebSocketContainerCustomizer.access$100(TomcatWebSocketContainerCustomizer.java:37) ~[spring-boot-autoconfigure-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.autoconfigure.websocket.TomcatWebSocketContainerCustomizer$1.customize(TomcatWebSocketContainerCustomizer.java:51) ~[spring-boot-autoconfigure-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.configureContext(TomcatEmbeddedServletContainerFactory.java:479) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.prepareContext(TomcatEmbeddedServletContainerFactory.java:221) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:176) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    	... 8 common frames omitted
    

    问题分析:我这个报错原因,网上查了半天,感觉应该是和jar包冲突有关,但找了半天也没找着冲突的jar包是哪个,但是jar包肯定跟tomcat有关,后来有个帖子说IDE集成tomcat会有影响,这个报错之前,我刚把Eclipse配置了RuntimeEnvironments,所以我再次把他去掉,问题解决。

    解决步骤:Eclipse-Windows-perferences-RuntimeEnvironments-将tomcat去掉。

  • 相关阅读:
    集成TBS(腾讯浏览服务)x5内核的webView
    android studio 华为手机看不到具体的错误日志
    android混淆那些事
    通用工具
    用队列来处理订单以及集合间性能比较
    从.Net版本演变看String和StringBuilder性能之争
    从事件来看委托
    从矢量来看运算符重载
    从foreach语句枚举元素看数组
    从装箱拆箱看泛型
  • 原文地址:https://www.cnblogs.com/xujie09/p/8437165.html
Copyright © 2011-2022 走看看