前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >"Unable to start embedded Tomcat" 问题

"Unable to start embedded Tomcat" 问题

作者头像
芥末鱿鱼
发布于 2022-05-05 06:43:45
发布于 2022-05-05 06:43:45
1.7K00
代码可运行
举报
文章被收录于专栏:玩转 Spring Cloud玩转 Spring Cloud
运行总次数:0
代码可运行

文章目录

报错堆栈日志

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
2019-11-05 14:43:34.593 ERROR 4536 --- [           main] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'traceFilterRegistration' defined in class path resource [org/springframework/cloud/netflix/eureka/server/EurekaServerAutoConfiguration.class]: Unsatisfied dependency expressed through method 'traceFilterRegistration' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.servlet.Filter' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=httpTraceFilter)}
2019-11-05 14:43:34.623  INFO 4536 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-11-05 14:43:34.628  WARN 4536 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2019-11-05 14:43:34.640  INFO 4536 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-11-05 14:43:34.798 ERROR 4536 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at com.deepflow.eurekaserver.EurekaServerApplication.main(EurekaServerApplication.java:12) [classes/:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:88) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:438) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:191) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	... 8 common frames omitted

分析原因

网上说了很多解决办法, 有的是手动配置配置一个外置的Tomcat, 有的说是jar包冲突. 仔细想想应该都没有把握核心, Springboot已经集成了内置的Tomcat, 所以没有必要再配置一个外置的Tomcat.

错误日志有一句信息很重要:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
2019-11-05 14:43:34.593 ERROR 4536 --- [           main] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'traceFilterRegistration' defined in class path resource [org/springframework/cloud/netflix/eureka/server/EurekaServerAutoConfiguration.class]: Unsatisfied dependency expressed through method 'traceFilterRegistration' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.servlet.Filter' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=httpTraceFilter)}

这句日志表明, Tomcat已经被引入进来了, 只是“traceFilterRegistration” 这个方法缺少一个参数, 导致Tomcat无法被加载进来.

由此可以想到有可能是Springcloud版本和Springboot版本不一致所导致的, 查看pom文件一看果然如此:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>

Springcloud的版本是Finchley.RELEASE, 这个版本对应的Springboot是: 2.0.0.RELEASE~2.0.9.RELEASE.换句话说就是低版本的cloud配了高版本的boot. boot版本往下降到2.0.x即可:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.9.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>

延伸

Springcloud版本和Springboot版本对应关系:https://cloud.tencent.com/developer/article/1991419

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019-11-05,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
文件系统学习-1
#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/fs.h> #include <linux/device.h> #include <linux/cdev.h> #include <linux/major.h> #include <linux/vfs.h> #define ROMFS_MAGIC 0xEBAF3421 static struct kmem_cache *
用户3765803
2019/03/05
6760
C语言函数大全--j开头的函数
J_0(x) = \sum_{m=0}^{\infty} \frac{(-1)^m}{(m!)^2} \left( \frac{x}{2} \right)^{2m}
huazie
2025/04/23
1460
C语言函数大全--j开头的函数
AI 真的提高了我的工作效率
未来是 AI 的时代,博主最近写代码都喜欢用 AI 写个草稿,修修改改就能用,大幅提高了工作效率。举个例子:
Jasonangel
2024/04/22
1330
AI 真的提高了我的工作效率
从 0 开始学 Linux 驱动开发(一)
最近在搞IoT的时候,因为没有设备,模拟跑固件经常会缺/dev/xxx,所以我就开始想,我能不能自己写一个驱动,让固件能跑起来?因此,又给自己挖了一个很大坑,不管最后能不能达到我的初衷,能学到怎么开发Linux驱动,也算是有很大的收获了。
Seebug漏洞平台
2019/02/26
2.1K0
Linux驱动开发13个实用案例
以下为你提供20个Linux驱动开发的实用案例,涵盖字符设备驱动、块设备驱动、网络设备驱动等不同类型,包含应用场景、技巧、代码示例和操作步骤。先赞再看后评论,腰缠万贯财进门。
威哥爱编程
2025/02/21
1970
开源项目的测试和质量保证
本文深入研究了开源项目中测试和质量保证的重要性,以及如何实施有效的测试策略来确保开源软件的质量。通过案例研究和最佳实践,我们将了解测试在开源项目中的角色,以及如何确保开源软件满足用户的期望。
猫头虎
2024/04/09
2060
开源项目的测试和质量保证
异步处理的强力助手:Linux Workqueue 机制详解
“ 在 Linux 内核中,workqueue 是一个重要的机制,用于处理那些不紧急且适合异步执行的任务。本文将详细介绍 workqueue 的基本概念及其在中断处理中的作用,揭示其如何通过后台线程提高系统的响应速度和性能。探讨 workqueue 的实现原理、创建与销毁过程,并讨论如何通过该机制优化系统任务调度。”
Lion 莱恩呀
2024/08/01
7840
异步处理的强力助手:Linux Workqueue 机制详解
Linux slab分配器
在Linux中,伙伴系统是以页为单位分配内存。但是现实中很多时候却以字节为单位,不然申请10Bytes内存还要给1页的话就太浪费了。slab分配器就是为小内存分配而生的。slab分配器分配内存以Byte为单位。但是slab分配器并没有脱离伙伴系统,而是基于伙伴系统分配的大内存进一步细分成小内存分配。
刘盼
2021/04/13
2.2K0
Linux slab分配器
一文轻松学会linux字符设备驱动
在linux系统中许多外围设备都被规定为字符设备,诸如按键、触摸屏、重力传感器、LED、光敏传感器等,这些设备都需要字符设备驱动才能正常工作。本章就来实现一个标准的字符设备驱动框架模板,目的是为以后的设备驱动提供标准模板,提高开发效率与代码整洁度。
开源519
2020/09/20
1.7K0
一文轻松学会linux字符设备驱动
slab的简单使用
#include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/fs.h> #define CUTBAG_DIR "CU_T-bagwell" #define MAX_STRING_TEST 20 static struct kmem_cache *T_bagwell_slab_test; struct test{       
用户3765803
2019/03/05
8930
Linux内存管理之MMU的过程
之前写过一篇《CPU是如何访问内存的?》的文章,简单介绍了cpu访问内存的过程。有了之前的感性认识,这篇站在arm的角度再深度讲解一下,看完你会发现不理解arm原理就直接撸内核代码简直是耍流氓。
刘盼
2020/06/22
2.4K0
PCI设备驱动程序「建议收藏」
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/huangweiqing80/article/details/83347495
全栈程序员站长
2022/11/18
2.6K0
PCI设备驱动程序「建议收藏」
精选6个C++项目,推荐新人练手首选!
原创地址:https://mp.weixin.qq.com/s?__biz=Mzg4NDQ0OTI4Ng==&mid=2247485799&idx=1&sn=49369686896c5e3413d9e
嵌入式Linux内核
2023/08/24
1.7K0
[network][udp]你不要偷偷发包,我跟你讲
前言: 互联网后台的服务器上,通常需要运行多达数百个进程,甚至更多。 有一天,运维兄弟突然找上门,说:xx服务器上为什么要访问yy服务(例如yy服务使用UDP的12345端口)? 开发一脸懵逼:没有呀!并不是我部署的服务访问的。。。 运维兄弟:我不管,这台机器分配给你了,你要负责,要不你抓包看看? 开发兄弟娴熟的一手tcpdump -iany -Xnnls0 udp port 12345:哎呦我去,还真有进程在访问,but,是哪个进程呢?UDP无连接,netstat是没有办法了,tcpdump只能证明有包发
皮振伟
2018/04/09
1.9K0
【Linux探索学习】第十三弹——进程状态:深入理解操作系统进程状态与Linux操作系统中的进程状态
https://blog.csdn.net/2301_80220607/category_12805278.html?spm=1001.2014.3001.5482
GG Bond1
2024/11/18
1780
【Linux探索学习】第十三弹——进程状态:深入理解操作系统进程状态与Linux操作系统中的进程状态
find_sys_call_table和kallsysms_lookup_name的区别
find_sys_call_table 和 kallsyms_lookup_name 都可以用于查找内核符号,但它们的具体作用和使用场景有所不同。以下是两者的详细对比:
233333
2024/05/30
3630
通过netfilter使用get/setsockopt实现用户态与内核模块之间的通信
本文讲述通过netfilter和get/setsockopt实现用户态与内核态之间的通信。首先介绍相关背景,然后给出代码示例。重点在于介绍通过netfilter的钩子机制实现用户态设置和获取socket选项,从而完成用户态与内核态之间的通信。
雷大亨
2018/01/01
2.9K0
内核线程的创建和运行
通过 ps 命令可以看到红色方框标出的都是父进程为2号进程的内核线程,2号进程即蓝色方框标出的进程 kthreadd,1号进程是绿色方框标出的进程 init,它们的父进程号都是0。
刘盼
2021/07/05
1.9K2
内核线程的创建和运行
linux设备驱动第二篇:如何写一个简单内核驱动?
上一篇介绍了linux驱动的概念,以及linux下设备驱动的基本分类情况及其各个分类的依据和差异,这一篇我们来描述如何写一个类似hello world的简单测试驱动程序。而这个驱动的唯一功能就是输出hello world。 在编写具体的实例之前,我们先来了解下linux内核下调试程序的一个重要函数printk以及几个重要概念。 printk类似c语言的printf,是内核中输出打印信息的函数。以后驱动调试中的重要性不言而喻,下面先做一个简单介绍。 printk的级别 日志级别一共有8个级别,printk
程序员互动联盟
2018/03/12
1.7K0
linux设备驱动第二篇:如何写一个简单内核驱动?
嵌入式Linux系列第20篇:驱动编写入门
很早之前就有网友建议写一篇关于Linux驱动的文章。之所以拖到现在才写,原因之一是我之前没有在工作中遇到需要自己手动去写驱动的需求,主要是现在Linux内核驱动的支持已经比较完善了,另外一个原因是自己水平实在有限,不敢写驱动这个话题,Linux驱动里涉及到的东西太多了,很多年前专门买过驱动相关的书籍,厚厚的,看的云里雾里。借此机会,在这里给大家做个非常非常入门级的介绍,希望对大家有所帮助。
用户2366192
2021/05/31
2.6K0
相关推荐
文件系统学习-1
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验