gpt4 book ai didi

java - IDEA Ultimate 2019.3 上的 org.springframework.boot.web.embedded.tomcat.ConnectorStartFailedException

转载 作者:行者123 更新时间:2023-11-30 01:41:49 25 4
gpt4 key购买 nike

我有一个项目,我正在其中工作,它是使用 Java 11+Spring Boot+Gradle 制作的。
突然,当我在 IntelliJ Idea Ultimate 2019.3 上按下播放键时,出现以下错误。

<String that tells the given command for launching the app>
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.4.RELEASE)

org.springframework.boot.web.embedded.tomcat.ConnectorStartFailedException: Connector configured to listen on port 8080 failed to start
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.checkConnectorHasStarted(TomcatWebServer.java:232)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.checkThatConnectorsHaveStarted(TomcatWebServer.java:224)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:202)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:311)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:164)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at it.niuma.epp.EPPApplication.main(EPPApplication.java:79)

Process finished with exit code 0

仅此而已。 Main类的代码就是由这些行组成的

@EnableScheduling
@EnableAsync
@SpringBootApplication(scanBasePackages = {list of packages})
public class EPPApplication implements WebMvcConfigurer {

public static void main(String[] args) {
/* Allows slash url encoding */
// System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH",
// "true");
SpringApplication.run(EPPApplication.class, args);

}

如果我没有将 SpringApplication.run 包含在 try-catch 范围内,我什至不会收到错误。
该项目尝试在端口 8080 上启动,该端口没有被任何东西占用。事实上,通过输入

netstat -ano|findstr "PID :8080"

在我的 Windows 计算机上,这是显示的结果

C:\Users\Gianmarco>netstat -ano|findstr "PID :8080"
Proto Indirizzo locale Indirizzo esterno Stato PID
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 18152
TCP [::]:8080 [::]:0 LISTENING 18152

当我尝试更改为任何其他可能的端口时,我总是会遇到相同的错误。

我错过了什么?我试图在 SO 上看到其他类似的问题,但没有人遇到我同样的问题

编辑:Eclipse 上也会发生同样的情况

EDIT2:通过从 org.apache.catalina.connector.Connector.startInternal() 开始跟踪调试器,我发现它甚至到达了记录器部分,其中声明已在端口上启动了 tomcat 8080 但这没有记录在控制台上。不久之后,我到达 SpringApplication.java 的第 400 行,它调用第 327 行,在其中我看到变量 colled exceptionReporters (一个集合)持有一个期望。以下屏幕截图代表了该集合所包含的内容。不过,在这之后,我似乎无法再调试了,但应用程序仍然卡住

enter image description here

应用程序属性

EDIT3:根据要求,这是我的 application.properties,我的 build.gradle

server.port=8080
application.base.path=/opt/epp
spring.datasource.tomcat.minSize=35
spring.datasource.tomcat.initialSize=35
spring.datasource.tomcat.maxActive=250

logging.config=file:config/logback.xml

datasource.type = oracle

# spring.mvc.throw-exception-if-no-handler-found=true
# spring.resources.add-mappings=false
# spring.mvc.static-path-pattern=/**
# spring.resources.static-locations=classpath:/static/

#MAIL CONFIG
spring.mail.default-encoding=UTF-8
[...]


# FROM OLD INTERNAL APPLICATION.PROPERTIES
server.servlet.context-path=/epp
spring.session.store-type=none
#logging.level.org.springframework.web=INFO
#logging.file=log/asta.log
#logging.pattern.file=="%d{dd-MMM-yyyy HH:mm:ss,SSS} %-5p [%c:%L]-> %m%n
spring.mustache.expose-session-attributes=true
spring.mustache.allow-request-override=true
#spring.mustache.allow-session-override=true
#server.session.cookie.max-age=60
#server.session.timeout=60
# Charset of HTTP requests and responses. Added to the "Content-Type" header if not set explicitly.
spring.http.encoding.charset=UTF-8
# Enable http encoding support.
spring.http.encoding.enabled=true
# Force the encoding to the configured charset on HTTP requests and responses.
spring.http.encoding.force=true
spring.servlet.multipart.max-file-size=150MB
spring.servlet.multipart.max-request-size=150MB
spring.mustache.suffix=.html

####### DEV ONLY, TO CHANGE IN PRODUCTION ##########
#logging.level.org.springframework.security=DEBUG
# see ldap.enabled
ldap.mock_email = false
debug.clientTrace = false
remember_me.cookie_only = true
remember_me.enabled_by_default = false
spring.mustache.cache = true
spring.cache.type = simple

#GESTIONE APERTURA VALUTAZIONE DA PARTE DEL BUYER
flg.can.buyer.evaluate=true
flg.gestione.prequalifica=false

#soglia di sbarramento in percentuale
soglia.sbarramento = 40

# in ambiente integrato va decommentato
# server.servlet.session.cookie.name = MYSESSIONID


zip.buffer.size = 8192

构建.gradle

buildscript {
dependencies {
classpath ("org.hidetake:gradle-ssh-plugin:2.8.0")
}
}

plugins {
id 'org.springframework.boot' version '2.1.4.RELEASE'
id 'java'
id 'eclipse-wtp'
id "org.zeroturnaround.gradle.jrebel" version "1.1.8"
}

apply plugin: 'org.hidetake.ssh'
apply plugin: 'io.spring.dependency-management'

jar.dependsOn(generateRebel)

compileJava {
options.encoding = 'UTF-8'
}

bootJar {
launchScript()
}

springBoot {
buildInfo {
properties {
artifact = 'EPP-ORDER NTT'
version = project.hasProperty('buildversion') ? buildversion: ''
group = 'it.niuma.epp'
name = 'test+order'
additionalProperties = [
operatingSystem: "${System.properties['os.name']} (${System.properties['os.version']})",
//machine: InetAddress.localHost.hostName,
]
}
}
}

archivesBaseName = project.hasProperty('archives_base_name') ? archives_base_name : 'epp'
ext.jarPath = project.hasProperty('jarPath') ? "${projectDir}/${jarPath}" : "${buildDir}/libs/epp.jar"

//archivesBaseName = project.hasProperty('archives_base_name') ? archives_base_name : 'supplier_portal'
//ext.jarPath = project.hasProperty('jarPath') ? "${projectDir}/${jarPath}" : "${buildDir}/libs/supplier_portal.jar"

ext.deployPath = project.hasProperty('deployPath') ? deployPath : '/opt/epp'

sourceCompatibility = 11
targetCompatibility = 11

repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}

dependencies {
// Framework - START
implementation 'org.springframework.boot:spring-boot-starter'
implementation('org.springframework.boot:spring-boot-starter-data-rest')
implementation('org.springframework.boot:spring-boot-starter-jdbc')
implementation('org.springframework.boot:spring-boot-starter-websocket')
implementation('org.springframework.boot:spring-boot-starter-mustache')
implementation('com.github.sps.mustache:mustache-spring-view:1.4')
implementation('org.springframework.boot:spring-boot-starter-mail')
implementation('org.springframework.boot:spring-boot-starter-web-services')
implementation('org.springframework.boot:spring-boot-starter-security')
implementation('org.springframework.security:spring-security-ldap')

// required by LDAP (spring-ldap bug?)
implementation group: 'commons-pool', name: 'commons-pool', version: '1.6'

// required by Logback for conditional processing
implementation group: 'org.codehaus.janino', name: 'janino', version: '3.0.12'

// Framework - END

// DB - START
implementation('org.sql2o:sql2o:1.6.0-RC3')
implementation group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '7.2.1.jre11'
// FOR INTEGRATION TEST DB
implementation files('libs/ojdbc8.jar')
implementation('org.sql2o.extensions:sql2o-oracle:1.6.0-RC3') {
exclude group:'com.oracle'
}
// DB - END

// Excel support - START
implementation('org.apache.poi:poi:3.16')
implementation('org.apache.poi:poi-ooxml:3.16') {
exclude group:'stax', module: 'stax-api'
}
// Excel support - END

// Cerved - START
implementation files('libs/CervedObject.jar')
implementation files('libs/CervedWebServices.jar')
implementation group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.2'
implementation group: 'com.sun.istack', name: 'istack-commons-runtime', version: '3.0.8'
// Cerved - END

// START FLYING SAUCER
implementation group: 'org.xhtmlrenderer', name: 'flying-saucer-pdf-openpdf', version: '9.1.18'
implementation group: 'org.jsoup', name: 'jsoup', version: '1.11.3'
// END FLYING SAUCER

// START DSS
implementation('org.digidoc4j.dss:dss-pades:5.2.d4j.3')
implementation group: 'org.digidoc4j.dss', name: 'dss-service', version: '5.2.d4j.3'
implementation group: 'org.digidoc4j.dss', name: 'dss-token', version: '5.2.d4j.3'
implementation group: 'org.digidoc4j.dss', name: 'dss-utils-apache-commons', version: '5.2.d4j.3'
// END DSS

// START UNIT TEST 1
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude group: 'junit', module: 'junit'
}
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.4.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.4.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.4.2'
testImplementation group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.4.2'
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.4.2'
// END UNIT TEST 1

// MISCELLANEOUS - START

implementation group: 'org.iban4j', name: 'iban4j', version: '3.2.1'
implementation group: 'org.hibernate', name: 'hibernate-validator', version: '6.0.8.Final'
implementation 'com.opencsv:opencsv:4.0'
implementation group: 'org.unbescape', name: 'unbescape', version: '1.1.6.RELEASE'

// MISCELLANEOUS - END


/***** TOREMOVE - START *****/

// iText 5 - START
implementation('com.itextpdf:itextpdf:5.5.11')
implementation('com.itextpdf.tool:xmlworker:5.5.11')
// iText 5 - END

/***** TOREMOVE - END *****/



/* ORDER Dependecies */
compile group: 'com.google.code.gson', name: 'gson', version: '2.7'
compile group: 'org.digidoc4j.dss', name: 'dss-utils-google-guava', version: '5.2.d4j.3'
compile group: 'org.xhtmlrenderer', name: 'flying-saucer-pdf-openpdf', version: '9.1.12'

// https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-rt
compile group: 'com.sun.xml.ws', name: 'jaxws-rt', version: '2.3.2'

// https://mvnrepository.com/artifact/org.passay/passay
compile group: 'org.passay', name: 'passay', version: '1.4.0'

// SWAGGER
/*****compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'

// LOMBOK
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.10' *****/

// MODEL MAPPER
compile group: 'org.modelmapper.extensions', name: 'modelmapper-spring', version: '2.3.2'






}


// START UNIT TEST 2
test {
useJUnitPlatform()
}
test.enabled = gradle.startParameter.taskNames.contains('test') || gradle.startParameter.taskNames.contains('check')
// END UNIT TEST 2

// Remote administration - START

remotes {
server {
deleted sensible data
}
}

ssh.settings {
logging = 'stdout'
knownHosts = allowAnyHosts
}

task copyjar {
doLast {
if (!project.hasProperty('ip')){
logger.lifecycle("No IP - Launch with -Pip=xxx.xxx.xxx.xxx");
throw new StopExecutionException()
}

logger.lifecycle("Copying... <$jarPath to $deployPath>")

ssh.run{
session(remotes.server) {
put from: jarPath, into: deployPath
}
}
}
}

task stopServer {
doLast {
if (!project.hasProperty('ip')){
logger.lifecycle("No IP - Launch with -Pip=xxx.xxx.xxx.xxx");
throw new StopExecutionException()
}
logger.lifecycle("Execute stopServer on $remotes.server.host");

if (project.hasProperty('cmd')){
cmd = project.hasProperty('cmd') ? cmd : ''
ssh.run {
session(remotes.server) {
execute cmd
}
}
} else {
ssh.run {
session(remotes.server) {
execute 'sudo systemctl stop epp.service'
}
}
}
}
}

task startServer{
doLast {
if (!project.hasProperty('ip')){
logger.lifecycle("No IP - Launch with -Pip=xxx.xxx.xxx.xxx");
throw new StopExecutionException()
}
logger.lifecycle("Execute stopServer on $remotes.server.host");

if (project.hasProperty('cmd')){
cmd = project.hasProperty('cmd') ? cmd : ''
ssh.run {
session(remotes.server) {
execute cmd
}
}
} else {
ssh.run {
session(remotes.server) {
execute 'sudo systemctl start epp.service'
}
}
}
}
}

// Remote administration - STOP

task copyBuildFiles(type: Copy) {
from file("application.properties")
into ("$buildDir/libs/")
}

build.dependsOn(copyBuildFiles)

最佳答案

由于缺少日志记录输出,您可能会遇到一些与日志记录相关的依赖项的问题。例如,对 commons-logging:commons-logging 的依赖可能会导致问题,应该排除它,而使用 org.springframework:spring-jclorg.slf4j:jcl-over-slf4j 应进行类似处理。

您可以使用 Gradle 的 dependencyInsight 任务了解类路径上是否存在以下任一依赖项:

gradle dependencyInsight --dependency commons-logging:commons-logging
gradle dependencyInsight --dependency org.slf4j:jcl-over-slf4j

关于java - IDEA Ultimate 2019.3 上的 org.springframework.boot.web.embedded.tomcat.ConnectorStartFailedException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59669527/

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