写的一个springboot小项目,打的jar包在服务器上跑着,在没人访问的情况下会报这个错误。但是tomcat服务并不会结束,还可以正常使用。这个是什么问题呢?项目只使用了SSM,其他的都没使用。
这个是部分配置文件,因为安装了ssl证书,会将http转发为https
#ServerProperties
server.port=443
server.servlet.context-path=/pic
#ssl证书名称
server.ssl.key-store=classpath:www.
#SSL密码
server.ssl.key-store-password=
server.ssl.key-store-type=jks
#tomcat
server.tomcat.uri-encoding=utf-8
server.tomcat.basedir=/usr/local/pic/img/log
server.tomcat.relaxed-query-chars=<,>,[,],^,`,{,|,}
server.tomcat.connection-timeout=20000
server.tomcat.max-http-form-post-size=3145728
server.max-http-header-size=8192
#mysql数据库的配置
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://characterEncoding=utf-8&useSSL=false&serverTimezone=Hongkong
spring.datasource.username=
spring.datasource.password=
#spring.datasource.url=jdbc:mysql://localhost:3307/img?characterEncoding=utf-8&useSSL=false&serverTimezone=Hongkong
#spring.datasource.username=root
#spring.datasource.password=root
#连接池的配置
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.maximum-pool-size=15
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.idle-timeout=30000
@Configuration
public class HttpsConfig {
@Bean
public TomcatServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint constraint = new SecurityConstraint();
constraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
constraint.addCollection(collection);
context.addConstraint(constraint);
}
};
tomcat.addAdditionalTomcatConnectors(httpConnector());
return tomcat;
}
private Connector httpConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
// Connector 监听的 http 的端口号
connector.setPort(8090);
connector.setSecure(false);
// 监听到http的端口号后转向到的https的端口号
connector.setRedirectPort(443);
return connector;
}
}