Kamalam
Kamalam

Reputation: 1254

How to stop jetty runner from executing

Am using jettyrunner for executing my war files.I am using command java -jar jetty runner ex.war.But am running this jetty server from my java application by executing this commands from java.My problem is at first time its working good,but the second time if i am again executing another war file with the same code its executing the older war.i have found the reason that the older jetty server is keep on running.How could i stop this server from java in order to start the jetty server for another war.

Upvotes: 1

Views: 4430

Answers (2)

ENargit
ENargit

Reputation: 613

Turned out, jetty-runner.jar doesn't have a feature to stop existing jetty process ran with stop-port and stop-key.

I found the answer in https://github.com/jetty-project/jetty-documentation/blob/master/src/docbkx/administration/runner/jetty-runner.xml

Then, to stop jetty from a different terminal, you need to supply the same port and key information. For this you'll either need a local installation of jetty, the jetty-maven-plugin jetty-ant plugin, or write a custom class

Fortunately, I was implementing gradle build, so jetty-ant satisfied my needs.

Upvotes: 0

jesse mcconnell
jesse mcconnell

Reputation: 7182

One option should be:

http://wiki.eclipse.org/Jetty/Howto/Secure_Termination

Another would be to use the ShutdownHandler:

http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ShutdownHandler.java

Or don't use the jetty-runner directly like that from java code and just write a small embedded usage:

http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty

Upvotes: 2

Related Questions