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);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean. nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.報錯解決 錯誤之Request processing failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined org.springframework.beans.FatalBeanException: Could not copy property 'commentCounts' from source to target;異常解決 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xtCsDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanC org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.facto linux發布springboot org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'異常解決
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM