eclipsewebserverjettyapplication-server

could not find start.ini in jetty 10/11 versions


I am updating jetty 9 to jetty11 but could not find start.ini in jetty11 as it was there in jetty9. I use start.ini to enable modules like 'requestlog', 'http-forwarded', 'session-cache-hash', jetty.session.evictionPolicy, 'console-capture' , 'slf4j-simple-impl' and jetty.http.idleTimeout.

I searched on the internet and referred (below link) but couldn't find anything related to it.

  1. https://github.com/eclipse/jetty.project/releases/tag/jetty-10.0.6
  2. https://www.eclipse.org/jetty/documentation/jetty-10/operations_guide.php

Solution

  • There is no "distribution" like there was in Jetty 9.

    Historically, the "distribution" tarball/zip back in the Jetty 6 thru Jetty 8 days was a complete Jetty server, with a configured demo, which you would mutate / edit / change / delete / modify / mangle to setup for your instance.

    This was changed in Jetty 9, where we encouraged the use of separate directories for ${jetty.home} and ${jetty.base}.

    So the "distribution" archive in Jetty 9 was changed to be ...

    [jetty-distribution-9.4.43.v20210624]$ java -jar start.jar 
    2021-08-03 08:30:38.725:INFO::main: Logging initialized @548ms to org.eclipse.jetty.util.log.StdErrLog
    2021-08-03 08:30:38.926:WARN:oejs.HomeBaseWarning:main: This instance of Jetty is not running from a separate {jetty.base} directory, this is not recommended.  See documentation at https://www.eclipse.org/jetty/documentation/current/startup.html
    2021-08-03 08:30:38.958:INFO:oejs.Server:main: jetty-9.4.43.v20210624; built: 2021-06-24T15:27:24.306Z; git: 704864489c7e58c0a4c6c969721e9b9a3f25416b; jvm 11.0.10+9
    

    See the "WARN" telling you "This instance of Jetty is not running from a separate {jetty.base} directory, this is not recommended. See documentation at https://www.eclipse.org/jetty/documentation/current/startup.html"

    The Jetty 9 releases were an interim model, where we still allowed the old-school Jetty 8 (and older) techniques, but that model was a bad idea, and still is a bad idea.

    By the time Jetty 10 got released, we no longer ship a "distribution", but rather only the "jetty-home".

    Why?

    Well, keeping your instance configuration separate from the jetty-home means you can upgrade (or even downgrade) super easy.

    What do you need to do?

    1. download the jetty-home archive.
    2. unpack the jetty-home archive into a new directory. (don't change a thing in that jetty-home directory, treat it as a read-only. this is important)
    3. create a new directory for your ${jetty.base} somewhere (that is not nested within the jetty-home directory)
    4. configure your ${jetty.base} with whatever modules you need/want
    5. install your webapps and/or extra jars or configuration into your ${jetty.base}
    6. cd to your ${jetty.base} directory and run the jetty-home/start.jar

    Looks like this ...

    $ cd $HOME/jetty
    # Download archive
    $ curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/10.0.6/jetty-home-10.0.6.tar.gz
    # Unpack archive
    $ tar -zxf jetty-home-10.0.6.tar.gz
    # Create your ${jetty-base}
    $ mkdir my-jetty-base
    $ cd my-jetty-base
    # Configure your ${jetty.base}
    $ java -jar ../jetty-home-10.0.6/start.jar --add-modules=deploy,http
    $ cp $HOME/code/myapp.war webapps/
    # Execute your ${jetty.base} instance
    $ java -jar ../jetty-home-10.0.6/start.jar
    

    Now lets say a new version of Jetty 10.x is released, what do you do now?

    Download the new jetty-home archive, unpack it, and use it (no configuration step required)

    # Download archive
    $ curl -O https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/10.0.7/jetty-home-10.0.7.tar.gz
    # Unpack archive
    $ tar -zxf jetty-home-10.0.7.tar.gz
    # Change to your existing ${jetty.base}
    $ cd my-jetty-base
    # Execute your ${jetty.base} instance
    $ java -jar ../jetty-home-10.0.7/start.jar
    

    You can even keep your ${jetty.base} configuration in a git repo, or move it to a jetty.docker image as-is without caring about the version of Jetty (well, you have to care about the differences in Jetty 10 to Jetty 11, but that's due to the Jakarta "Big bang", not anything that Jetty has broken)