0

I have a java web application which uses spring boot, it is packaged as a war file and then I deploy the war file using jetty runner and an xml config file using this command:

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

the jetty xml has the following

<?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>

when I execute the above command I got the following output

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

What I would like to know is how can I specify where jetty will unzip the war

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

the problem with this that on Linux, after a few days the OS removes the content of the temp directory and the application fails

I already look at jetty reference guide and here but I fail to see a parameter that I can use to change the location.

is it possible to overwrite such path on jetty runner?

1 Answers1

1

Thanks to Joakim Erdfelt, he just gave the clue I needed

it was just needed to add -Djava.io.tmpdir=./scratch to the command

java -Djava.io.tmpdir=./scratch -jar jetty-runner-9.2.9.v20150224.jar --config jetty.xml  application.war

in addition to this, also can be specified -Djetty.home=dir if you need, after that the war was unzipped in a different place

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