Jetty Plugin 9 startup does not like icu4j-2.6.1.jar

*爱你&永不变心* 提交于 2019-12-10 10:31:13

问题


I have the same configuration for maven jetty plugin 6 from mortbay

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

and for maven jetty plugin 9 from eclipse

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

The first one is working, the second is not, giving the following error:

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)
...

At the end it says Started Jetty Server, but the page gives 503.

Additional info: I'm having a multimodule project, parent project and two child projects, one of which is a webapp and other some plain Java that builds to jar. I have the jetty plugin in the webapp pom.


回答1:


The artifact class com/ibm/icu/impl/data/LocaleElements_zh__PINYIN.class in artifact icu4j-2.6.1.jar is known to be bad, as in the bytecode itself is bad.

Update icu4j and/or the library that is using icu4j, and it will go away.

As for why it works on Jetty 6 and not Jetty 9, is that you just did the equivalent of 13 major version updates of Jetty. That's like going from MSDOS to Windows 10 directly, skipping all of the intermediary releases.

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

You went from Servlet 2.5 to Servlet 3.1, as well, and the requirement to scan your webapp for annotations was introduced. Jetty 6 didn't care about icu4j, and didn't scan your webapp. Jetty 9 is required to scan all bytecode in your webapp for annotations and classes that implement key interfaces required by the servlet spec.

Because of this new bytecode scan, Jetty is now fully aware of the icu4j issue you've always had, and is reporting it.



来源:https://stackoverflow.com/questions/38802954/jetty-plugin-9-startup-does-not-like-icu4j-2-6-1-jar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!