How to deploy my web application to jetty9 as root application?
In Jetty 6, if you had
${jetty.home}/contexts/myapp.xml
With Jetty 9.0, move it to
${jetty.home}/webapps/myapp.xml
With Jetty 9.1+, move it to
${jetty.base}/webapps/myapp.xml
Make sure the exploded webapp directory is the same name as your xml file to prevent double deployment.
You also need to change your Context XML File for Jetty 9.
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="war"><Property name="jetty.home" default="." />/webapps/myapp</Set>
</Configure>
Or alternatively, just name your exploded webapp directory
${jetty.home}/webapps/ROOT
Documentation found:
http://www.eclipse.org/jetty/documentation/current/configuring-deployment.html
Updated for Jetty 9.1
Tom
Updated on July 24, 2022Comments
-
Tom almost 2 years
When I use jetty6, I use the following:
<Configure class="org.mortbay.jetty.webapp.WebAppContext"> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- Required minimal context configuration : --> <!-- + contextPath --> <!-- + war OR resourceBase --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <Set name="contextPath">/</Set> <Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/webapps/myapp</Set> </Configure>
this file located in folder contexts,named myapp.xml
But switch to jetty 9, first there is no such folder "contexts", and I put myapp.xml into webapps just like test.xml, restart jetty and navigate to
http://localhost:8080
, the page remain the default one, not my application.Can anybody give me a hint?
-
Tom over 11 yearsThanks, seems working,form the log I can see my app deployed,but the page of "localhost:8080" is still the default one.I want my application is the root application.
-
Wang Tang almost 6 yearsA tad late, but for reference: this method works, but only if you move or rename the existing webapps/root directory. Source: did not find it in the documentation, i.e., trial and error. I'm using jetty 9.2 on Debian/stretch.
-
Alejandro Duarte almost 3 yearsI guess the correct link is now wiki.eclipse.org/Jetty/Howto/…