如何将我的Web应用程序部署到jetty9作为root应用程序?

Tom*_*Tom 9 jetty

当我使用jetty6时,我使用以下内容:

<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>
Run Code Online (Sandbox Code Playgroud)

此文件位于文件夹上下文中,名为myapp.xml

但是切换到jetty 9,首先没有这样的文件夹"contexts",我将myapp.xml放入webapps就像test.xml一样,重启jetty并导航到http://localhost:8080,页面仍然是默认的,而不是我的应用程序.

任何人都可以给我一个提示吗?

Joa*_*elt 19

在码头6,如果你有

${jetty.home}/contexts/myapp.xml
Run Code Online (Sandbox Code Playgroud)

使用Jetty 9.0,将其移至

${jetty.home}/webapps/myapp.xml
Run Code Online (Sandbox Code Playgroud)

使用Jetty 9.1+,将其移至

${jetty.base}/webapps/myapp.xml
Run Code Online (Sandbox Code Playgroud)

确保展开的webapp目录与xml文件的名称相同,以防止双重部署.

您还需要更改Jetty 9的Context XML File.

<!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>  
Run Code Online (Sandbox Code Playgroud)

或者,只需为爆炸的webapp目录命名即可

${jetty.home}/webapps/ROOT
Run Code Online (Sandbox Code Playgroud)

找到的文件:

http://www.eclipse.org/jetty/documentation/current/configuring-deployment.html

针对Jetty 9.1进行了更新