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 ...
随机推荐
- Microsoft 发布 .NET 9 RC 2
距离最终版本还有一个月的时间,Microsoft 已经交付了 .NET 9 的第二个也是最后一个候选版本..NET 团队在公告帖子中写道[1],"当我们为 11 月的 .NET 9 正式发布 ...
- 007 Python、Anaconda、pip、Pycharm、Jupyter都是啥?
博客配套视频链接: https://space.bilibili.com/383551518?spm_id_from=333.1007.0.0 b 站直接看 配套 github 链接:https:// ...
- k8s的ReplicationController
ReplicationController 存活探针 Kubemetes有以下三种探测容器的机制: HTTPGET探针对容器的IP地址(你指定的端口和路径)执行HTTPGET请求,如果探测器收到响应, ...
- docker打包镜像,上传镜像仓库,使用rancher发布
步骤一.首先将项目打包放在指定目录下 项目jar包名称为 micro-app.jar 步骤二.将jar包名称改为指定名称,执行命令 docker build -t micro-gateway: ...
- 记录一次edu的小通杀
记录一次edu的小通杀 fofa查询随便点的一个虚拟仿真实训系统,存在多处未授权.逻辑漏洞,并且存在文件上传漏洞导致getshell,检索下来差不多十几个学校在用 从虚拟仿真系统入手感觉容易一些,一个 ...
- 云原生周刊:Score 成为 CNCF 沙箱项目|2024.08.12
开源项目推荐 KubeOne Kubermatic KubeOne 自动化管理您所有云环境.本地环境.边缘计算和物联网环境中的集群操作.KubeOne 可以安装高可用(HA)的主集群,也可以安装单主集 ...
- OpenPSG:离AGI再进一步,首个开放环境关系预测框架 | ECCV'24
全景场景图生成(PSG)的目标是对对象进行分割并识别它们之间的关系,从而实现对图像的结构化理解.以往的方法主要集中于预测预定义的对象和关系类别,因此限制了它们在开放世界场景中的应用.随着大型多模态模型 ...
- .NET开发者福音:JetBrains官方宣布 Rider 非商用免费开放!
前言 JetBrains官方前段时间宣布重磅消息,其两款知名IDE应用WebStorm和Rider现已面向社区开放,允许用户免费用于非商业用途.此举旨在支持学习.开源项目开发.内容创作及业余开发等活动 ...
- Selenium IDE使用指南一(爬虫脚本录制器)
安装 从Chrome或Firefox网络商店安装Selenium IDE . 启动IDE 安装后,通过从浏览器菜单栏中单击其图标来启动它. 故障排除 在菜单栏中没有看到Selenium IDE的图标? ...
- Java垃圾回收器总结
什么是Java垃圾回收器 Java垃圾回收器是Java虚拟机(JVM)的三个重要模块(另外两个是解释器和多线程机制)之一,为应用程序提供内存的自动分配(Memory Allocation).自动回收( ...