【问题标题】:Jetty : Path of Extracted war码头:提取战争之路
【发布时间】:2012-01-09 13:03:40
【问题描述】:

我在 Jetty Server 中部署了一个.war 文件。

服务器已经启动,但是请告诉我在哪里可以看到那个war文件的内容??

我已经读到了:

如果提取参数为真,任何打包的战争或 zip 文件将 部署前先解压到一个临时目录。

请告诉我在哪里可以设置提取参数为真,临时文件夹路径是什么??

这是我的jetty-webapps.xml 文件

<Configure id="Server" class="org.eclipse.jetty.server.Server">
    <Ref id="DeploymentManager">
          <Call id="webappprovider" name="addAppProvider">
            <Arg>
              <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
                <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
                <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
                <Set name="scanInterval">1</Set>
                <Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set>
        <Set name="extractWars">true</Set>
              </New>
            </Arg>
          </Call>
    </Ref>
</Configure>

【问题讨论】:

    标签: jetty


    【解决方案1】:

    检查日志文件。它应该有这样的

    2012-11-06 17:41:54.334:INFO:oejw.WebInfConfiguration:提取 jar:file:/usr/oc/jcast8083/webapps/spdy.war!/ 到 /tmp/jetty-0.0.0.0-8083 -spdy.war-_spdy-any-/webapp

    在这种情况下,war文件的内容在

    /tmp/jetty-0.0.0.0-8083-spdy.war-_spdy-any-/webapp

    【讨论】:

      【解决方案2】:

      您部署的所有war文件都提取到Jetty_Home/work中以进行部署。但是,如果您希望在部署到工作文件夹之前将 war 文件提取到 temp 文件夹中,那么您可以在 jetty-webapps.xml 文件中将 extractWars 参数设置为 true。 jetty-webapps.xml 文件位于Jetty_HOME/etc/ 文件夹中。

      <Configure id="Server" class="org.eclipse.jetty.server.Server">
          <Ref id="DeploymentManager">
                <Call id="webappprovider" name="addAppProvider">
                  <Arg>
                    <New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
                      <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
                      <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set>
                      <Set name="scanInterval">1</Set>
                      <Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set>
              <Set name="extractWars">true</Set>
                    </New>
                  </Arg>
                </Call>
          </Ref>
      </Configure>
      

      【讨论】:

      • 感谢您的回答,但我找不到工作文件夹,我正在使用 jetty8
      • 您的 jetty_home 中有 etc 文件夹吗?你在用linux吗?并使用 apt-get 安装了码头?
      • 检查 jetty-webapp.xml,它应该将 extractWar 字段设置为 true。另外,您正在运行哪个版本的码头?
      • 我正在使用 Jetty8,这是我的 jetty-webapp.xml 文件(我已经修改了我的问题以在 etc 文件夹中添加 jetty-webapps.xml 文件),因为您可以看到已经存在 extractWars 集为真。
      • 看“extractWars”参数,它已经设置为true,现在部署任何war时,在部署前都会先将其提取到temp文件夹中。临时文件夹的位置是 /tmp(Linux 临时文件夹)
      【解决方案3】:

      据此Link

      你的选择很少。

      1) 指定您自己的 java.io.tmpdir java 系统属性位置供 jetty 使用。

      $ java -Djava.io.tmpdir=/path/to/my/new/temp/ -jar start.jar
      

      2) 在${jetty.home} 路径下创建一个“工作”目录(无论是哪一个)。 这将导致 Jetty 使用该工作目录,而不是 java.io.tmpdir 属性设置的任何内容。

      3) 在 WebAppProvider 部署中指定 tempDir 属性。

      仅对war文件部署场景有效,对基于上下文的部署无效。

      如果您的start.ini 中有etc/jetty-webapps.xml,则您启用了war 文件部署。

      编辑${jetty.home}/etc/jetty-webapps.xml 文件并在WebAppProvider 上再添加1 个属性。 &lt;Set name="tempDir"&gt;/path/to/my/preferred/temp/dir/for/all/webapps&lt;/Set&gt;

      4) 使用基于上下文的部署在 WebAppContext 上设置 tempDirectory 属性。 不适用于战争文件部署方案。

      如果您的start.ini 中有etc/jetty-context.xml,则您启用了基于上下文的部署。

      编辑${jetty.home}/contexts/myapp.xml 并在WebAppContext 上添加tempDirectory 属性。 &lt;Set name="tempDirectory"&gt;/path/to/my/preferred/temp/dir/for/this/context&lt;/Set&gt;

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-09-26
        • 1970-01-01
        • 2017-07-30
        • 2011-08-27
        • 1970-01-01
        • 2013-09-24
        • 1970-01-01
        相关资源
        最近更新 更多