zoukankan      html  css  js  c++  java
  • Spring Boot 进程守护 修改启动端口号 Spring Boot 监听端口被占用无法启动

    使用 java -jar gs-spring-boot-0.1.0.jar 命令启动 spring-boot, 由于默认端口号为8080, 且此端口被tomcat占用, 所以启动时出现以下错误:

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

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

    Description:

    The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.

    Action:

    Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.

    由于没有源码, 不太懂Java开发, 所以从代码内修改端口无法实现.

    通过搜索 查询到 可以使用启动命令 修改启动端口号, 此方法适用.

    使用以下命令指定端口8897启动Spring Boot:
    java -jar -Dspring.config.location=application.properties -Dserver.port=8896 /usr/local/java_jar/gs-spring-boot-0.1.0.jar

    进程守护,关闭终端依然可以访问.

    nohup java -jar -Dspring.config.location=application.properties -Dserver.port=8896 /usr/local/java_jar/gs-spring-boot-0.1.0.jar  &

    jar文件的路径 建议使用绝对路径, 这样下次启动比较方便.

    注:即使application.properties文件中设置了server.port=8080,启动端口也是: 8896


    ————————————————
    参考网址: https://blog.csdn.net/m0_37739193/article/details/83388271 感谢无私分享.

  • 相关阅读:
    设计模式(一)基础面向对象
    面试题之三门问题
    「巫师3(The Witcher 3:Wild Hunt)」游戏测评
    欧拉角和四元数
    struts标签遍历各种list Map
    浅谈HtmlCleaner+XPath解析html或者xml
    hadoop简单例子
    解决JSP参数传递乱码的问题
    Set、List、Map的区别(浅谈)
    做个犀利的码农
  • 原文地址:https://www.cnblogs.com/levia/p/14860086.html
Copyright © 2011-2022 走看看