gpt4 book ai didi

java - 升级Spring Boot版本1.5.19后,嵌入式tomcat无法启动,原因是端口可能已在使用中或连接器配置错误

转载 作者:行者123 更新时间:2023-11-28 23:54:53 27 4
gpt4 key购买 nike

将Spring Boot升级到1.5.19后,无法启动嵌入式Tomcat,并出现以下错误。


  错误:-配置为侦听端口8443的Tomcat连接器失败
  开始。该端口可能已在使用中,或者连接器可能已在使用中
  配置错误。


我已经升级到以下版本。

springBootVersion = '1.5.19.RELEASE'
springVersion = '4.3.22.RELEASE'
jerseyVersion = '1.17'
springDataJpaVersion = '1.5.19.RELEASE'
tomcatVersion = '8.5.37'


启动tomcat时,即使端口未使用,我也收到错误消息,而且我尝试使用其他端口,因此多数情况是由于配置错误所致。

我也尝试过用pkcs12代替jks。

以下是我的嵌入式tomcat ssl配置-

    Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
try {
File keystore = getFile(getKeystore());
File truststore = keystore;
connector.setScheme("https");
connector.setSecure(true);
connector.setPort(getHTTPSPort());
//connector.setXpoweredBy(false);

//protocol.setKeystoreType("PKCS12");
protocol.setSSLEnabled(true);
protocol.setKeystoreFile(keystore.getAbsolutePath());
protocol.setKeystorePass(getKeystorePass());
protocol.setTruststoreFile(truststore.getAbsolutePath());
protocol.setTruststorePass(getKeystorePass());
//protocol.setKeyAlias("tomcat");
return connector;
} catch (IOException ex) {
throw new IllegalStateException("can't access keystore: [" + "keystore" + "] or truststore: [" + "keystore" + "]", ex);
}


//等级依赖

compile(
[group: 'ch.vorburger.mariaDB4j', name: 'mariaDB4j', version: '2.1.1'],

//NOVOBANK
[group: 'org.activiti', name:'activiti-engine', version: activitiVersion],
[group: 'org.activiti', name:'activiti-spring', version: activitiVersion],
[group: 'org.apache.velocity', name: 'velocity', version: '1.7'],
[group: 'org.springframework.security', name: 'spring-security-ldap', version: '5.1.3.RELEASE'],

[group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion],
[group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: springBootVersion],
[group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: springBootVersion],

[group: 'org.springframework', name: 'spring-context-support', version: springVersion],

[group: 'javax.ws.rs', name: 'jsr311-api', version: '1.1.1'],
[group: 'com.sun.jersey', name: 'jersey-core', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-servlet', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-server', version: jerseyVersion],
[group: 'com.sun.jersey', name: 'jersey-json', version: jerseyVersion],
[group: 'com.sun.jersey.contribs', name: 'jersey-spring', version: jerseyVersion],
[group: 'com.sun.jersey.contribs', name: 'jersey-multipart', version: jerseyVersion],

[group: 'com.squareup.retrofit', name: 'retrofit', version: '1.6.1'],
[group: 'com.squareup.okhttp', name: 'okhttp', version: '2.0.0'],
[group: 'com.squareup.okhttp', name: 'okhttp-urlconnection', version: '2.0.0'],


[group: 'com.google.code.gson', name: 'gson', version: '2.3'],
[group: 'com.google.guava', name: 'guava', version: '15.0'],

[group: 'joda-time', name: 'joda-time', version: '2.4'],
[group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'],
[group: 'org.apache.commons', name: 'commons-email', version: '1.3.3'],
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'],
[group: 'commons-io', name: 'commons-io', version: '2.4'],

// no slf4j & logback here (anymore), as spring-boot-starter-logging already brings this now, better assembled (log4j-over-slf4j was originally forgotten here)

[group: 'mysql', name: 'mysql-connector-java', version: '5.1.27'],
[group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: tomcatVersion],

[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-core', version: '7.0.0.3-64'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-extensions', version: '7.0.0.3-64'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-extensions-scripting', version: '7.0.0.3-64'],
[group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-wizard-core', version: '7.0.0.3-64'],
[group: 'pentaho-report-designer', name: 'pentaho-reporting-engine-wizard-xul', version: '3.9.1-GA'],

[group: 'pentaho-library', name: 'libbase', version: '7.0.0.3-64'],
[group: 'pentaho-library',name: 'libdocbundle', version: '7.0.0.3-64'],
[group: 'pentaho-library',name: 'libfonts', version: '7.0.0.3-64'],
[group: 'pentaho-library',name: 'libformat', version: '7.0.0.3-64'],
[group: 'pentaho-library',name: 'libformula', version: '7.0.0.3-64'],
[group: 'pentaho-library',name: 'libloader', version: '7.0.0.3-64'],
[group: 'pentaho-library',name: 'librepository', version: '7.0.0.3-64'],
[group: 'pentaho-library',name: 'libserializer', version: '7.0.0.3-64'],
[group: 'pentaho-library',name: 'libsparkline', version: '7.0.0.3-64'],
[group: 'pentaho-library',name: 'libxml', version: '7.0.0.3-64'],
[group: 'net.sourceforge.barbecue',name: 'barbecue', version: '1.5-beta1'],
[group: 'net.sf.barcode4j',name: 'barcode4j', version: '2.1'],

[group: 'org.apache.poi',name: 'poi', version: '3.9'],
[group: 'org.apache.poi',name: 'poi-ooxml', version: '3.9'],
[group: 'org.apache.poi',name: 'poi-ooxml-schemas', version: '3.9'],

[group: 'com.lowagie', name: 'itext', version: '2.1.7'],
[group: 'com.lowagie', name: 'itext-rtf', version: '2.1.7'],
[group: 'org.mnode.ical4j', name: 'ical4j', version: '1.0.4'],
[group: 'com.googlecode.flyway', name: 'flyway-core', version: '2.1.1'],
[group: 'org.quartz-scheduler', name: 'quartz', version: '2.1.7'],
[group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.2.1'],
[group: 'net.sf.ehcache', name: 'ehcache', version: '2.7.2'],
[group: 'com.github.spullara.mustache.java', name: 'compiler', version: '0.8.12'],
[group: 'com.jayway.jsonpath', name: 'json-path', version: '0.9.1'],
[group: 'org.apache.tika', name: 'tika-core', version :'1.9'],
[group: 'org.apache.tika', name: 'tika-parsers', version :'1.13'],

// Although Mifos (at the time of writing) doesn't have any compile time dep. on this,
// it's useful to have this for the Spring Boot TestRestTemplate http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-rest-templates-test-utility
[group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.5'],

[group: 'org.jasypt', name: 'jasypt', version: '1.9.2'],
[group: 'org.simpleframework', name: 'simple-xml', version: '2.7.1'],

//J8583 - ISO For Demo Auth
[group: 'net.sf.j8583', name: 'j8583', version: '1.12.0'])


堆栈跟踪

17:31:50.501 [main] DEBUG o.s.b.d.LoggingFailureAnalysisReporter - Application failed to start due to an exception
org.springframework.boot.context.embedded.tomcat.ConnectorStartFailedException: Connector configured to listen on port 8443 failed to start
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.checkThatConnectorsHaveStarted(TomcatEmbeddedServletContainer.java:237)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:213)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:308)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:147)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:124)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134)
at org.mifosplatform.ServerApplication.main(ServerApplication.java:41)
17:31:50.501 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter -




申请开始失败



描述:

配置为侦听端口8443的Tomcat连接器无法启动。该端口可能已在使用中,或者连接器配置错误。

如果我手动启动tomcat并部署我的代码,则该代码可以正常工作,
问题仅在我尝试启动嵌入式tomcat时出现。

最佳答案

我在spring-boot-2.1.6中遇到了同样的问题。最终的解决方案是什么?

关于java - 升级Spring Boot版本1.5.19后,嵌入式tomcat无法启动,原因是端口可能已在使用中或连接器配置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54767437/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com