【问题标题】:Restart current application in Jetty在 Jetty 中重新启动当前应用程序
【发布时间】:2012-08-02 21:46:41
【问题描述】:

我在 Jetty 上部署一个 Web 应用程序作为战争。
有没有办法以编程方式重新启动 Jetty 上当前正在运行的应用程序?
有Jetty配置可以实现吗?

【问题讨论】:

标签: java jetty


【解决方案1】:

有 3 个选项。

  1. 使用 JMX

    通过 jetty-jmx 库和配置尝试 enabling JMX。 然后探索上下文或部署者的选项,看看您是否可以使用 JMX 来管理已部署的上下文

  2. 创建您自己的Server bean 来管理上下文的部署/取消部署

  3. 创建您自己的 AppProvider,提供给 DeploymentManager,以编程方式控制已安装的上下文。

【讨论】:

    【解决方案2】:

    这是解决这个问题的尝试:https://github.com/giuliano108/jetty-manager

    sudo -u username jetty-manager
    
    Usage:
      jetty-manager jvms
      jetty-manager webapps <jvm> [ <webappfilter> ]
      jetty-manager threads <jvm>
      jetty-manager stop <jvm> <webappfilter>
      jetty-manager start <jvm> <webappfilter>
      jetty-manager restart <jvm> <webappfilter>
      jetty-manager (-h | --help)
    
    Commands:
      jvms           Show the running JVMs (PID, name)
      webapps        Show the webapps hosted by <jvm> and their state
      threads        Show the total number of threads in the <jvm>
    
    Arguments:
      <jvm>          JVM PID or regexp (matched against the JVM name)
      <webappfilter> regexp matched against the context path (URL)
    
    Options:
      -h --help     Show this screen
    

    【讨论】:

      猜你喜欢
      • 2022-10-13
      • 1970-01-01
      • 2019-11-18
      • 1970-01-01
      • 2021-11-11
      • 2021-06-11
      • 1970-01-01
      • 2015-01-12
      • 2013-06-12
      相关资源
      最近更新 更多