I have what I thought was a a simple task. Deploy a war into a jetty (v9.4) server and run the server. I packaged up the war and copied it into a nested folder in the $JETTY_BASE/webapps directory. I started up the server with the command jetty -jar $JETTY_HOME/start.jar jetty.http.port=10202
. Everything seemed good, the server started up with no errors. However, when I try to navigate to what should be the index page in a browser, instead I get a page listing all the files in the directory. If I try to actually get to any of my services I get a 404 error.
The strange thing is, If I do the exact same thing but place the war directly under the webapps directory I can hit the index page just fine. I'm sure it's just a configuration option I missed somewhere by I have no idea which one. Does anyone know what I need to do to get this working?
For reference here is my jetty-web.xml for the application:
<Configure id="eyerep-data" class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/eyerep-data</Set>
<Set name="war"><SystemProperty name="jetty.monitorDir" default="./webapps" />/eyerep-data.war</Set>
</Configure>
The war is deployed to $JETTY_BASE/webapps/eyerep-data/eyerep-data.war
CodePudding user response:
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/jetty</Set>
<Set name="war">absolute/path/to/jetty-app.war</Set>
</Configure>
http://localhost:8080/jetty.
ContextPath is important
Works for me
<Set name="monitoredDir">
<SystemProperty name="jetty.home" default="." />my/context
</Set>
Absolute path
<Set name="monitoredDir">/my/context</Set>
CodePudding user response:
I think I finally figured it out. I needed to remove the leading '/' from my context path.