【问题标题】:Boot Spring Application failed on sub user子用户启动 Spring 应用程序失败
【发布时间】:2018-08-14 19:06:39
【问题描述】:

每当我尝试运行我的 Spring Boot 应用程序时,我的 Linux 机器都会返回以下问题:

org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-80]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
        at org.apache.catalina.core.StandardService.addConnector(StandardService.java:225) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23][...](LifecycleBase.java:150) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
        ... 21 common frames omitted
Caused by: java.net.SocketException: Permission denied[...]

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

希望有人可以帮助我。

【问题讨论】:

    标签: linux spring tomcat spring-boot


    【解决方案1】:

    我猜你在 Ubuntu 上。 1024以下的端口只能由root打开,所以作为普通的非特权用户,你不能在80端口上运行你的应用程序。为什么不使用server.port属性使用另一个端口?

    【讨论】:

      【解决方案2】:

      正如明确提到的,该端口已在使用中。配置 spring boot 以使用其他端口。

      如文档中所述,要么使用 jvm --server.port=8090 的命令行选项将 server.port 设置为系统属性,要么在 /src/main/resources/ 中添加 application.properties

      server.port = 8090 随机端口使用

      server.port=0

      【讨论】:

        【解决方案3】:

        如果 Ubuntu 或 Debian 使用 Sudo your_command,请以 root 身份运行它。因为 1024 以下的端口只能由 root 使用。

        【讨论】:

          猜你喜欢
          • 2017-10-07
          • 2017-05-12
          • 2019-02-02
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2022-01-21
          • 2021-06-06
          • 1970-01-01
          相关资源
          最近更新 更多