【问题标题】:could not find start.ini in jetty 10/11 versions在 jetty 10/11 版本中找不到 start.ini
【发布时间】:2021-10-08 16:57:16
【问题描述】:

我正在将 jetty 9 更新为 jetty11,但在 jetty11 中找不到 start.ini,因为它在 jetty9 中。 我使用 start.ini 来启用像 'requestlog'、'http-forwarded'、'session-cache-hash'、jetty.session.evictionPolicy、'console-capture'、'slf4j-simple-impl' 和 jetty.http 这样的模块.idleTimeout。

我在互联网上搜索并参考(以下链接)但找不到任何相关内容。

  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

【问题讨论】:

    标签: eclipse webserver jetty application-server


    【解决方案1】:

    没有像 Jetty 9 那样的“分布”。

    从历史上看,Jetty 6 到 Jetty 8 天的“分发”tarball/zip 是一个完整的 Jetty 服务器,带有配置的演示,您可以对其进行变异/编辑/更改/删除/修改/修改以设置您的实例。

    这在 Jetty 9 中进行了更改,我们鼓励为 ${jetty.home}${jetty.base} 使用单独的目录。

    所以 Jetty 9 中的“分发”存档被更改为 ...

    • jetty-home-<ver>.tar.gz
    • 带有start.ini,警告您不要直接使用jetty-home
    • 带有/demo-base${jetty.base} 示例
    [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
    

    请参阅“警告”,告诉您“此 Jetty 实例未从单独的 {jetty.base} 目录运行,不建议这样做。请参阅https://www.eclipse.org/jetty/documentation/current/startup.html" 的文档

    Jetty 9 版本是一个过渡模型,我们仍然允许使用老式的 Jetty 8(和更旧的)技术,但该模型是一个坏主意,现在仍然是一个坏主意。

    到 Jetty 10 发布时,我们不再发布“发行版”,而只发布“jetty-home”。

    为什么?

    嗯,将您的实例配置与 jetty-home 分开意味着您可以非常轻松地升级(甚至降级)。

    你需要做什么?

    1. 下载 jetty-home 存档。
    2. 将 jetty-home 存档解压到一个新目录中。 (不要更改 jetty-home 目录中的任何内容,将其视为只读。这很重要)
    3. 在某处为您的 ${jetty.base} 创建一个新目录(不嵌套在 jetty-home 目录中)
    4. 使用您需要/想要的任何模块配置您的 ${jetty.base}
    5. 将您的 webapps 和/或额外的 jars 或配置安装到您的 ${jetty.base}
    6. cd 到您的${jetty.base} 目录并运行jetty-home/start.jar

    看起来像这样......

    $ 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
    

    现在假设发布了新版本的 Jetty 10.x,你现在做什么?

    下载新的 jetty-home 存档,解压并使用(无需配置步骤)

    # 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
    

    您甚至可以将 ${jetty.base} 配置保存在 git 存储库中,或者将其移动到 jetty.docker 映像,而无需关心 Jetty 的版本(嗯,您必须关心 Jetty 10 与Jetty 11,但那是由于雅加达的“大爆炸”,而不是 Jetty 破坏的任何东西)

    【讨论】:

    • 感谢您的详细解释。我知道从jetty10开始,我们将拥有jetty home和jetty base目录,jetty home目录将用作只读目录,jetty base目录将用作工作目录。所以,我的问题是,我将在哪里添加像 'ttf=application/font-sfnt 和 otf=font/opentype' 这样的 mime 属性,因为我以前在 lib\jetty-http-9.4.40.v20210413.jar\ 中这样做org\eclipse\jetty\http 文件夹。因为jetty home是jetty10的只读目录
    • 如果您有 WAR,请使用标准方式在 WEB-INF/web.xml 中执行。如果您有代码,或者正在使用低级 Jetty 处理程序 API,请使用内部 MimeTypes 对象。
    • 您能否添加更多解释或任何我可以参考的参考文档添加 mimeTypes?我也想修改etc\jetty.XML,etc\webdefault.XML,etc\jetty-request log.xml。我们是否需要编写自定义 XML 来修改 etc\jetty.XML, etc\webdefault.XML, etc\jetty-request log.xml
    • @AshishGoyanka 请正确使用 stackoverflow。为后续问题使用新问题。
    猜你喜欢
    • 1970-01-01
    • 2021-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-24
    • 2015-10-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多