How to deploy a war file to jetty

Like what we often do in tomcat, we can still static or hot deploy war file(packed or unpacked) to Jetty container, this tutorial will demonstrate how to deploy a war file to jetty?

If you do static deployment.

When Jetty startup, it scans its $JETTY_HOME/webapps directory for web applications to deploy.

To deploy a WAR file, just copy warfile  into $JETTY_HOME/webapps and then restart jetty to take effect.

You can restart jetty by using either the following command or double-click Jetty-Service.exe:

java -jar start.jar

If you do hot deployment:

Jetty scans the $JETTY_HOME/contexts directory for runtime deployment.

To hat deploy a WAR file, copy warfile  into $JETTY_HOME/contexts, no need to restart jetty, it will automatically deploy the war file to jetty’s container.

The URL of new web app is http://localhost:8080/warfilename/, where warfilename is the name of your war file.

Rate article
ASJAVA.COM
Add a comment

Your email address will not be published. Required fields are marked *