Reputation: 1873
I deploy a web application on Jetty as a war.
Is there a way in which I can restart the currently running application on Jetty programatically?
Is there a Jetty configuration that can achieve this?
Upvotes: 3
Views: 2645
Reputation: 31
This is an attempt at solving this problem: 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
Upvotes: 1
Reputation: 49555
There are 3 options.
Use JMX
Try enabling JMX via the jetty-jmx libs and configuration. Then poking around the options for the contexts or deployers to see if you can use JMX to manage the deployed contexts
Create your own Server bean to manage the deployment / undeployment of the contexts
Create your own AppProvider, provided to the DeploymentManager to programmatically control the installed contexts.
Upvotes: 2