关于spring boot报javax/servlet/MultipartConfigElement错误以及的问题

1、springboot在启动时报java.lang.NoClassDefFoundError: javax/servlet/MultipartConfigElement

关于spring boot报javax/servlet/MultipartConfigElement错误以及的问题_第1张图片

解决方法:将pom.xml文件中javax.servlet-api依赖的provided注释掉或者删掉,然后刷新pom.xml文件

关于spring boot报javax/servlet/MultipartConfigElement错误以及的问题_第2张图片

2、我在启动springboot项目时时报org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.在网上搜索解决方法,有说加@EnableAutoConfiguration注解的,但是在我这没管用,也有说将Spring Boot web依赖里的去除tomcat的

代码注掉的,结果也没解决。

关于spring boot报javax/servlet/MultipartConfigElement错误以及的问题_第3张图片

花了很长时间去找解决方法,都没有解决,还是靠自己去找原因及解决方法吧。

前文中提到要将Spring Boot web依赖里的去除tomcat的代码注掉的,除此之外还要将pom.xml文件中的spring-boot-starter-tomcat这个依赖也要注掉或者删除才行。别忘了刷新pom.xml。这样项目就能跑起来了。

关于spring boot报javax/servlet/MultipartConfigElement错误以及的问题_第4张图片

 

你可能感兴趣的:(关于spring boot报javax/servlet/MultipartConfigElement错误以及的问题)