如何设置码头运行器应用程序的 WebAppContext



我有一个使用弹簧引导的java Web应用程序,它被打包为战争文件然后我使用码头转轮部署 war 文件,并使用以下命令部署 xml 配置文件:

java -jar jetty-runner-9.2.9.v20150224.jar --config jetty.xml  application.war

码头 XML 具有以下内容

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
    <Call name="addConnector">
        <Arg>
            <New class="org.eclipse.jetty.server.ServerConnector">
                <Arg name="server">
                    <Ref refid="Server"/>
                </Arg>
                <Set name="port">
                    <Property name="jetty.port" default="1312"/>
                </Set>
                <Set name="idleTimeout">3000000</Set>
            </New>
        </Arg>
    </Call>
    <Set name="stopAtShutdown">false</Set>
    <Set name="stopTimeout">5000000000</Set>
</Configure>

当我执行上述命令时,我得到了以下输出

2018-04-06 10:07:01.953:INFO::main: Logging initialized @592ms
2018-04-06 10:07:01.997:INFO:oejr.Runner:main: Runner
2018-04-06 10:07:02.597:INFO:oejs.Server:main: jetty-9.2.9.v20150224
2018-04-06 10:07:18.437:INFO:/:main: Spring WebApplicationInitializers detected on classpath: [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JerseyWebApplicationInitializer@757942a1]
2018-04-06 10:07:49.516:INFO:/:main: Initializing Spring root WebApplicationContext
2018-04-06 10:07:55.120:INFO:/:main: Initializing Spring FrameworkServlet 'dispatcher'
DB created 1012 millis
2018-04-06 10:07:56.157:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@12f40c25{/,file:/C:/Users/winuser/AppData/Local/Temp/jetty-0.0.0.0-1312-application.war-_-any-6813620977412039270.dir/webapp/,AVAILABLE}{file:/D:/webApps/xcerb/cerebro/app/application.war}
2018-04-06 10:07:56.160:WARN:oejsh.RequestLogHandler:main: !RequestLog
2018-04-06 10:07:56.203:INFO:oejs.ServerConnector:main: Started ServerConnector@323659f8{HTTP/1.1}{0.0.0.0:1312}
2018-04-06 10:07:56.205:INFO:oejs.Server:main: Started @54855ms

我想知道的是我如何指定码头将在哪里解压缩战争

file:/C:/Users/winuser/AppData/Local/Temp/jetty-0.0.0.0-1312-application.war-_-any-6813620977412039270.dir/webapp/

这个问题是在 Linux 上,几天后操作系统会删除临时目录的内容并且应用程序失败

我已经查看了码头参考指南和此处,但我没有看到可用于更改位置的参数。

是否可以在码头跑步者上覆盖这样的路径?

感谢Joakim Erdfelt,他只是给了我需要的线索

只需要在命令中添加-Djava.io.tmpdir=./scratch

java -Djava.io.tmpdir=./scratch -jar jetty-runner-9.2.9.v20150224.jar --config jetty.xml  application.war
除此之外,如果需要

,还可以-Djetty.home=dir指定,之后战争被解压缩到不同的地方

file:/D:/webApps/xcerb/cerebro/scratch/jetty-0.0.0.0-1312-application.war-_-any-3819067265538641392.dir/webapp/

相关内容

最新更新