【问题标题】:Jetty Plugin 9 startup does not like icu4j-2.6.1.jarJetty Plugin 9 启动不喜欢 icu4j-2.6.1.jar
【发布时间】:2016-12-12 16:17:53
【问题描述】:

我对 mortbay 的 maven jetty 插件 6 有相同的配置

<plugin>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>maven-jetty-plugin</artifactId>
       <version>6.1.26</version>
</plugin>

对于来自 eclipse 的 maven jetty 插件 9

<plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>9.3.11.v20160721</version>
</plugin>

第一个有效,第二个无效,出现以下错误:

2016-08-06 11:43:59.281:INFO:oejs.Server:main: jetty-9.3.6.v20151106
2016-08-06 11:44:01.247:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.m.p.JettyWebAppContext@c85b0c{/,file:///C:/.../IdeaProjects/MultiModuleSimple/simple-webapp/src/main/webapp/,STARTING}{file:///C:/.../IdeaProjects/MultiModuleSimple/simple-webapp/src/main/webapp/}
java.lang.RuntimeException: Error scanning entry com/ibm/icu/impl/data/LocaleElements_zh__PINYIN.class from jar file:///C:/.../.m2/repository/com/ibm/icu/icu4j/2.6.1/icu4j-2.6.1.jar
    at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:937)
...

最后显示 Started Jetty Server,但页面显示 503。

附加信息:我有一个多模块项目、父项目和两个子项目,其中一个是 webapp 和其他一些构建到 jar 的普通 Java。我在 webapp pom 中有 jetty 插件。

【问题讨论】:

  • 我找到了解决方案。第一个 Jetty 插件 9 与我用来解析 XML 的 jaxen 库使用的 icu4j 库存在问题。我切换到 JSON。接下来在 jetty 插件 9 中,默认上下文是“/”(根模块),而在 jetty 插件 6 中,默认上下文是包含 jetty 的子模块。
  • jaxen ver 1.1.6 库工作正常!我只是简单地更新了 simple-weather 子模块中的 pom.xml 以使用最新版本的 jaxen。 (之前是 1.1.1,现在是 1.1.6)

标签: java maven server jetty maven-jetty-plugin


【解决方案1】:

工件icu4j-2.6.1.jar 中的工件类com/ibm/icu/impl/data/LocaleElements_zh__PINYIN.classknown to be bad,因为字节码本身是错误的。

更新icu4j 和/或正在使用icu4j 的库,它将消失。

至于为什么它可以在 Jetty 6 而不是 Jetty 9 上运行,是因为您刚刚执行了equivalent of 13 major version updates of Jetty。这就像直接从 MSDOS 转到 Windows 10,跳过所有中间版本。

Jetty versioning: [servlet-support].[major-version].[minor-version]
-------------------------------------------------------------------
6.1 - Servlet 2.5 / Mortbay
7.0 - Servlet 2.5 / Eclipse Foundation Move + OSGi
7.1 - NIO additions, websocket proposal + client support, SSL overhaul
7.2 - websocket drafts support - dropped java6 requirement
7.3 - the big debugging, logging, security, and session update
7.4 - large internal buffers / memory overhaul
7.5 - purge of pre java 1.6 hacks (old project), osgi / maven / deprecation overhaul
7.6 - SPDY introduced - servlet spec error handling overhaul
8.0 - Servlet 3.0 - Java 7 minimum requirement
8.1 - SPDY introduced
9.0 - Servlet 3.1-draft / blocking connectors dropped
9.1 - Servlet 3.1 final / Connector overhaul
9.2 - WebSocket RFC overhaul + JSR356 addition
9.3 - HTTP/2 introduced - Java 8 minimum requirement

您也从 Servlet 2.5 升级到 Servlet 3.1,并且引入了扫描您的 web 应用程序以查找注释的要求。 Jetty 6 不关心 icu4j,也没有扫描你的 webapp。 Jetty 9 需要扫描 webapp 中的所有字节码,以查找实现 servlet 规范所需的关键接口的注释和类。

由于这种新的字节码扫描,Jetty 现在完全了解您一直遇到的 icu4j 问题,并正在报告它。

【讨论】:

  • 我更新了库以使用最新版本,但它并没有消失。最终我切换到json。不喜欢与 DOS 和 Windows 进行类比 - 我看不出我跳过 13 个版本更新并直接进入最新版本的相关性是什么。否则解释很好,所以我给+1。请关闭线程。
猜你喜欢
  • 2014-04-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-27
  • 2022-08-03
相关资源
最近更新 更多