场景

在Eclipse中新建SpringBoot项目后启动项目提示:

SpringBoot项目启动提示:An attempt was made to call the method org.apache.coyote.AbstractProtocol.setAccept_springBoot启动报错

具体报错信息如下:

.   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.3.RELEASE)

2019-03-06 23:21:03.829 INFO 5080 --- [ main] c.e.demo.HelloSpringBootApplication

: Starting HelloSpringBootApplication on PC-20180724WIAC with PID 5080 (F:\EcpliseWorkspace

\helloSpringBoot\target\classes started by Administrator in F:\EcpliseWorkspace\helloSpringBoot)
2019-03-06 23:21:03.835 INFO 5080 --- [ main] c.e.demo.HelloSpringBootApplication

: No active profile set, falling back to default profiles: default
2019-03-06 23:21:05.047 WARN 5080 --- [ main]

ConfigServletWebServerApplicationContext : Exception encountered during context initialization -

cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to

start web server; nested exception is java.lang.NoSuchMethodError:

org.apache.coyote.AbstractProtocol.setAcceptCount(I)V
2019-03-06 23:21:05.059 INFO 5080 --- [ main]

ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with

'debug' enabled.
2019-03-06 23:21:05.066 ERROR 5080 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter

:

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call the method org.apache.coyote.AbstractProtocol.setAcceptCount(I)V but

it does not exist. Its class, org.apache.coyote.AbstractProtocol, is available from the

following locations:

jar:file:/D:/Tomcat7/apache-tomcat-7/lib/tomcat-

coyote.jar!/org/apache/coyote/AbstractProtocol.class
jar:file:/D:/Maven/maven-repository/org/apache/tomcat/embed/tomcat-embed-

core/9.0.16/tomcat-embed-core-9.0.16.jar!/org/apache/coyote/AbstractProtocol.class

It was loaded from the following location:

解决

这是因为给项目配置Tomcat了。

右击项目--Build Path--Config Build Path

SpringBoot项目启动提示:An attempt was made to call the method org.apache.coyote.AbstractProtocol.setAccept_springBoot启动报错_02

选择Tomcat,选择Remove--Apply and Close

SpringBoot项目启动提示:An attempt was made to call the method org.apache.coyote.AbstractProtocol.setAccept_springBoot启动报错_03

重新启动项目,不再报错。