当前位置: 首页 > article >正文

IDEA 社区版 SpringBoot不能启动

报错原因,Failed to load class [javax.servlet.Filter]

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

解决办法:

Run Configuration把Add dependences with "provided" scope to classpath勾上

报错信息:

 (SpringApplication.java:837)- Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [aaa.bbb.ccc.SpringApplication]; nested exception is org.springframework.core.NestedIOException: Failed to load class [javax.servlet.Filter]; nested exception is java.lang.ClassNotFoundException: javax.servlet.Filter
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:188)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:319)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
	at aaa.bbb.ccc.SpringApplication.main(SpringApplication.java:18)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.core.NestedIOException: Failed to load class [javax.servlet.Filter]; nested exception is java.lang.ClassNotFoundException: javax.servlet.Filter
	at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:692)
	at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getInterfaces(ConfigurationClassParser.java:1023)
	at org.springframework.context.annotation.ConfigurationClassParser.processInterfaces(ConfigurationClassParser.java:385)
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:331)
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:249)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:198)
	at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:303)
	at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:249)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:206)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:174)
	... 18 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at org.springframework.boot.devtools.restart.classloader.RestartClassLoader.loadClass(RestartClassLoader.java:144)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:348)
	at org.springframework.util.ClassUtils.forName(ClassUtils.java:284)
	at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:689)
	... 27 common frames omitted


http://www.kler.cn/a/466944.html

相关文章:

  • 详解GPT-信息抽取任务 (GPT-3 FAMILY LARGE LANGUAGE MODELS)
  • 对计网大题的一些指正(中间介绍一下CDM的原理和应用)
  • 【网络安全 | 漏洞挖掘】绕过电子邮件确认实现预账户接管
  • 9.系统学习-卷积神经网络
  • 【竞技宝】CS2:HLTV 2024 TOP11-w0nderful
  • C#调用Lua
  • QML自定义滑动条Slider的样式
  • [服务器][教程]Ubuntu24.04 Server开机自动挂载硬盘教程
  • 利用ChatGPT API构建智能应用的最佳实践
  • 深度剖析 DeepSeek V3 技术报告:架构创新与卓越性能表现
  • VR 合成层最多支持多少层?
  • 代码实战:基于InvSR对视频进行超分辨率重建
  • 现代光学基础5
  • 电子应用设计方案85:智能 AI门前柜系统设计
  • JVM实战—6.频繁YGC和频繁FGC的后果
  • 小程序添加购物车业务逻辑
  • 在ubuntu22.04中使用bear命令追踪内核编译报错的原因分析和解决方案
  • Three.js教程014:使用tween实现补间动画
  • Dubbo 关键知识点解析:负载均衡、容错、代理及相关框架对比
  • 浅谈分布式共识算法
  • springmvc--对日期类型如何处理
  • 三甲医院等级评审八维数据分析应用(二)--数据标准化体系篇
  • qt qss文件的使用
  • 数据挖掘——规则和最近邻分类器
  • 如何轻松关闭 iPhone 上的 HEIC [HEIC 图像技巧]
  • 嵌入式系统开发笔记112:通过有人云测试MQTT