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

1

2

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.

Tim answered 6/8, 2016 at 9:57 Comment(2)
I have found the solution. First Jetty plugin 9 has an issue with icu4j library that is used by jaxen library that I used to parse XML. I switched to JSON. Next in jetty plugin 9 the default context is "/" (root module), while in jetty plugin 6 the default context was the submodule where jetty is included.Tim
The jaxen ver 1.1.6 library worked! I simply updated the pom.xml in the simple-weather sub module to use the latest version of jaxen. (before was 1.1.1 and now 1.1.6)Stipulate
C
3

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.

Constantan answered 8/8, 2016 at 14:34 Comment(1)
I updated libraries to use latest versions but it didnt go away. Eventually I switched to json. Dont like the analogy with DOS and Windows - I dont see what is the relevancy that I skipped 13 version updates and went straight to latest. Otherwise the explanation is good so I give +1. Please close the thread.Tim

© 2022 - 2024 — McMap. All rights reserved.