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

悠悠 2023-10-18 15:16 248阅读 0赞

场景

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

![Image 1][]watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0JBREFPX0xJVU1BTkdfUUlaSEk_size_16_color_FFFFFF_t_70

具体报错信息如下:

  1. . ____ _ __ _ _
  2. /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
  3. ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
  4. \\/ ___)| |_)| | | | | || (_| | ) ) ) )
  5. ' |____| .__|_| |_|_| |_\__, | / / / /
  6. =========|_|==============|___/=/_/_/_/
  7. :: Spring Boot :: (v2.1.3.RELEASE)
  8. 2019-03-06 23:21:03.829 INFO 5080 --- [ main] c.e.demo.HelloSpringBootApplication
  9. : Starting HelloSpringBootApplication on PC-20180724WIAC with PID 5080 (F:\EcpliseWorkspace
  10. \helloSpringBoot\target\classes started by Administrator in F:\EcpliseWorkspace\helloSpringBoot)
  11. 2019-03-06 23:21:03.835 INFO 5080 --- [ main] c.e.demo.HelloSpringBootApplication
  12. : No active profile set, falling back to default profiles: default
  13. 2019-03-06 23:21:05.047 WARN 5080 --- [ main]
  14. ConfigServletWebServerApplicationContext : Exception encountered during context initialization -
  15. cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to
  16. start web server; nested exception is java.lang.NoSuchMethodError:
  17. org.apache.coyote.AbstractProtocol.setAcceptCount(I)V
  18. 2019-03-06 23:21:05.059 INFO 5080 --- [ main]
  19. ConditionEvaluationReportLoggingListener :
  20. Error starting ApplicationContext. To display the conditions report re-run your application with
  21. 'debug' enabled.
  22. 2019-03-06 23:21:05.066 ERROR 5080 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter
  23. :
  24. ***************************
  25. APPLICATION FAILED TO START
  26. ***************************
  27. Description:
  28. An attempt was made to call the method org.apache.coyote.AbstractProtocol.setAcceptCount(I)V but
  29. it does not exist. Its class, org.apache.coyote.AbstractProtocol, is available from the
  30. following locations:
  31. jar:file:/D:/Tomcat7/apache-tomcat-7/lib/tomcat-
  32. coyote.jar!/org/apache/coyote/AbstractProtocol.class
  33. jar:file:/D:/Maven/maven-repository/org/apache/tomcat/embed/tomcat-embed-
  34. core/9.0.16/tomcat-embed-core-9.0.16.jar!/org/apache/coyote/AbstractProtocol.class
  35. It was loaded from the following location:

解决

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

右击项目—Build Path—Config Build Path

![Image 1][]watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0JBREFPX0xJVU1BTkdfUUlaSEk_size_16_color_FFFFFF_t_70 1

选择Tomcat,选择Remove—Apply and Close

![Image 1][]watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0JBREFPX0xJVU1BTkdfUUlaSEk_size_16_color_FFFFFF_t_70 2

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

[Image 1]:

发表评论

表情:
评论列表 (有 0 条评论,248人围观)

还没有评论,来说两句吧...

相关阅读