Failed to start bean 'webServerStartStop'; nested exception is org.springframework.beans.FatalBeanException: ServletWebServerFactory implementation
使用jeecgboot报错
jeecg单测跑不起来,报错如下
Failed to start bean 'webServerStartStop'; nested exception is org.springframework.beans.FatalBeanException: ServletWebServerFactory implementation org.jeecg.config.init.TomcatFactoryConfig$1 cannot be instantiated. To allow a separate management port to be used, a top-level class or static inner class should be used instead
经验证需要配置端口
connector.setPort(Integer.valueOf(port));
package org.jeecg.config.init;
import javax.servlet.MultipartConfigElement;
import org.apache.catalina.connector.Connector;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.unit.DataSize;
/**
* @Description: TomcatFactoryConfig
* @author: scott
* @date: 2021年01月25日 11:40
*/
@Configuration
public class TomcatFactoryConfig {
@Value("${server.port}")
private String port;
@Value("${server.acceptorThreadCount}")
private String acceptorThreadCount;
@Value("${server.minSpareThreads}")
private String minSpareThreads;
@Value("${server.maxSpareThreads}")
private String maxSpareThreads;
@Value("${server.maxThreads}")
private String maxThreads;
@Value("${server.maxConnections}")
private String maxConnections;
@Value("${server.protocol}")
private String protocol;
@Value("${server.redirectPort}")
private String redirectPort;
@Value("${server.compression}")
private String compression;
@Value("${server.connectionTimeout}")
private String connectionTimeout;
@Value("${server.MaxFileSize}")
private String MaxFileSize;
@Value("${server.MaxRequestSize}")
private String MaxRequestSize;
@Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
tomcat.addConnectorCustomizers(new GwsTomcatConnectionCustomizer());
return tomcat;
}
// @Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
// 单个数据大小
factory.setMaxFileSize(DataSize.parse(MaxFileSize)); // KB,MB
/// 总上传数据大小
factory.setMaxRequestSize(DataSize.parse(MaxRequestSize));
return factory.createMultipartConfig();
}
/**
*
* 默认http连接
*
* @version
* @author liuyi 2016年7月20日 下午7:59:41
*
*/
public class GwsTomcatConnectionCustomizer implements TomcatConnectorCustomizer {
public GwsTomcatConnectionCustomizer() {
}
@Override
public void customize(final Connector connector) {
connector.setPort(Integer.valueOf(port));
// connector.setProperty("connectionTimeout", connectionTimeout);
// connector.setProperty("acceptorThreadCount", acceptorThreadCount);
// connector.setProperty("minSpareThreads", minSpareThreads);
// connector.setProperty("maxSpareThreads", maxSpareThreads);
// connector.setProperty("maxThreads", maxThreads);
// connector.setProperty("maxConnections", maxConnections);
// connector.setProperty("protocol", protocol);
// connector.setProperty("redirectPort", redirectPort);
// connector.setProperty("compression", compression);
connector.setProperty("relaxedPathChars", "[]{}");
connector.setProperty("relaxedQueryChars", "[]{}");
}
}
}
主要是去掉
((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
Failed to start bean 'webServerStartStop'; nested exception is org.springframework.beans.FatalBeanException: ServletWebServerFactory implementation的更多相关文章
- Spring MVC集成thymeleaf时提示:defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException
错误提示: defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean ...
- nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException
You should autowire interface AbstractManager instead of class MailManager. If you have different im ...
- Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExce
Error setting property values ; nested exception is org.springframework.beans.NotWritablePropertyExc ...
- Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.liuyang.JDbCTemplate.PersonDao]: No default constructor fo
错误是说我的配置文件中没有对构造函数进行配置,所以找不到构造函数,在配置文件application.xml中加入如下句子: <bean id="personDao" clas ...
- Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'dataSource' of bean class [com.liuyang.jdbc.PersonDao]: No property 'dataSource
这个错误是说我的启动失败了.这类问题要从配置文件中开始找原因,我用的是spring框架,所以我从application.中找的原因 然后对比路径,对比文件的命名和id,都没有问题,为什么会在启动的时候 ...
- Failed to start bean 'stompBrokerRelayMessageHandler'; nested exception is java.lang.NoClassDefFoundError: reactor/io/codec/Codec
最新版本的Spring需要reactor 2.0,看看你的POM有一个明确的1.1.6依赖. 解决: <dependency> <groupId>org.projectreac ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'supplierAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factor
这个错误是因为抽象Action类的时候,把ServletContext写成了serverContext,导致无法注入,正确写法是 import javax.annotation.Resource; i ...
- SpringBoot项目启动org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException解决方法
将Pom文件中的SpringBoot版本调低即可. 我的是调成了2.5.6
- SpringBoot项目集成Swagger启动报错: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is
使用的Swagger版本是2.9.2.knife4j版本是2.0.4. SpringBoot 版本是2.6.2将SpringBoot版本回退到2.5.6就可以正常启动
- Cannot resolve reference to bean 'mongoTemplate' while setting bean property 'mongoOperations'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with na
问题: Springboot 启动时出错,报没法创建bean的错误,看到nested最后是关于mongoTemplate的错误. 过程: 看网上大多说的是修改mongoTemplate的配置,但是sp ...
随机推荐
- Nuxt.js 应用中的 restart 事件钩子详解
title: Nuxt.js 应用中的 restart 事件钩子详解 date: 2024/10/14 updated: 2024/10/14 author: cmdragon excerpt: re ...
- 对于 Serverless, DevOps, 多云及边缘可观察性的思考与实践
从单体到微服务,再到 Serverless,应用在逐渐地轻量化.有人可能会有疑问,微服务都还没有顺畅的搭建起来,现在又出了 Serverless,应该怎么办? 其实两者之间并不是一个相互替代的关系.我 ...
- Chirpy+Github
相关网址 Chirpy 示例:网页上有官方教程,我写的肯定不全 Chirpy 示例仓库:这个就是包含官方教程的那个示例的仓库 Chirpy 模板仓库:直接 fork 这个仓库,快速搭建,没有多余的东西 ...
- 使用 Cursor 和 Devbox 快速开发并上线 Gin 项目
作为开发者,最让我们头疼的事情是什么?那必须是环境配置.版本控制以及各种部署配置等等繁琐的工作. 想象一下,如果你只需点击几下鼠标,就能拥有一个完全配置好的开发环境,支持从 Java 到 Python ...
- OpenGL with GLFW GLAD and CMAKE
0. 前言 首先,无论是在youtube还是网站上,许多OpenGL的环境配置都是在VS studio里配置的,个人比较喜欢使用VS code,以及Cmake. 下文给出了一个Cmake版本关于 GL ...
- Flink CDC同步MySQL数据到Iceberg实践
介绍 Flink CDC: 捕获数据库完整的变更日志记录增.删.改等所有数据. Flink在1.11版本开始引入了Flink CDC功能,并且同时支持Table & SQL两种形式.Flink ...
- CommonsCollections6(基于ysoserial)
环境准备 JDK1.8(8u421)我以本地的JDK8版本为准.commons-collections(3.x 4.x均可这里使用3.2版本) cc3.2: <dependency> &l ...
- How to disable ipv6 in ubuntu
To disable ipv6, you have to open /etc/sysctl.conf using any text editor and insert the following li ...
- VS中使用Qt方法详解
相信大家都知道在 Qt Creator 中可以使用 MSVC 编译工具对 Qt 项目进行编译.若有人比较习惯于使用 Visual Studio,或某些项目必须使用 Visual Studio,也可以在 ...
- Linux中更新系统时间、同步系统时间和硬件时间
更新系统的时间 1.手动修改 date -s # 不建议 2.时间同步服务器 ntpdate # 需要安装命令 yum -y install ntpdate [root@oldbo ...