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 感谢无私分享.

  • 相关阅读:
    opencv行列式按行(列)展开
    线性方程组
    opencvVideoCapture视频和摄像头读写
    浅谈测试的成就感
    关于软件测试职业规划的讨论 .
    多进程,多线程,就是这么回事儿
    测试计划的制定
    写给测试新手 .
    测试最需要的是淡定
    用一个比喻说明项目里各个成员的角色
  • 原文地址:https://www.cnblogs.com/levia/p/14860086.html
Copyright © 2011-2022 走看看