【问题标题】:Spring unable to start embedded tomcat server [duplicate]Spring无法启动嵌入式tomcat服务器[重复]
【发布时间】:2020-12-19 19:26:35
【问题描述】:

我尝试按照本教程进行操作:Using WebSocket to build an interactive web application

我用的是eclipse、debian10、maven 3.6、jdk1.8、tomcat8。

导入 git 项目后,我想运行“完整”文件夹。但是我收到以下错误: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server [...]

我没有编辑任何东西,所以我真的很困惑这个错误可能来自哪里。

【问题讨论】:

标签: java spring tomcat


【解决方案1】:

显然 8080 端口已被使用。 我通过像这样简单地更改 Spring Boot 应用程序的端口解决了这个问题

编辑 MessagingStompWebsocketApplication.java

@SpringBootApplication
public class MessagingStompWebsocketApplication {
  public static void main(String[] args) {
    SpringApplication app = new SpringApplication(MessagingStompWebsocketApplication.class);
    app.setDefaultProperties(Collections.singletonMap("server.port","8089"));
    app.run(args);
  }
}

【讨论】:

    【解决方案2】:

    如果该端口已被使用,您只需将这一行添加到application.properties 即可更改端口:

    server.port=8081
    

    Baeldung

    【讨论】:

      猜你喜欢
      • 2019-10-11
      • 2021-05-25
      • 2023-03-26
      • 2016-08-19
      • 1970-01-01
      • 2017-09-20
      • 2018-07-12
      • 2021-02-20
      • 2020-05-18
      相关资源
      最近更新 更多