javajerseyjersey-1.0

Jersey 1.x - compatibility


Is Jersey 1.8 compatible with Java 8?

Also, is Jersey 1.8 compatible with WildFly 8 on Java 8?

I developed and I am now maintaining a REST web service project which produces a WAR.

We started having some problems with this like 6 months ago (but btw we only now noticed them). See error and screenshot below.

After doing quite some research on the web, it seems to me the problems are related to the fact that our project was migrated to Java 8 and WildFly 8 (previously it was running on Tomcat 6 with Java 6).

So... I thought the solution is to migrate to at least Jersey 1.9 (we don't want to use the Jersey 2.x line). I tried it but I am getting the same error.

So... is Jersey 1.x at all compatible with WildFly 8 and Java 8?

The error which we started getting looks like this.

    07:27:33,894 INFO  [com.sun.jersey.api.core.WebAppResourceConfig] (default task-7) Scanning for root resource and provider classes in the Web app resource paths:
      /WEB-INF/lib
      /WEB-INF/classes
    07:27:36,984 ERROR [io.undertow.request] (default task-7) UT005023: Exception handling request to /rpt/rpt-rest-service/report: java.lang.ArrayIndexOutOfBoundsException: 1901
            at org.objectweb.asm.ClassReader.readClass(Unknown Source) [asm-3.1.jar:3.1]
            at org.objectweb.asm.ClassReader.accept(Unknown Source) [asm-3.1.jar:3.1]
            at org.objectweb.asm.ClassReader.accept(Unknown Source) [asm-3.1.jar:3.1]
            at com.sun.jersey.spi.scanning.AnnotationScannerListener.onProcess(AnnotationScannerListener.java:133) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.core.spi.scanning.JarFileScanner.scan(JarFileScanner.java:97) [jersey-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.spi.scanning.WebAppResourcesScanner$1.f(WebAppResourcesScanner.java:94) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.core.util.Closing.f(Closing.java:71) [jersey-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.spi.scanning.WebAppResourcesScanner.scan(WebAppResourcesScanner.java:92) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.spi.scanning.WebAppResourcesScanner.scan(WebAppResourcesScanner.java:79) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:80) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.api.core.WebAppResourceConfig.init(WebAppResourceConfig.java:100) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.api.core.WebAppResourceConfig.<init>(WebAppResourceConfig.java:87) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.api.core.WebAppResourceConfig.<init>(WebAppResourceConfig.java:72) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.spi.container.servlet.WebComponent.getWebAppResourceConfig(WebComponent.java:672) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.spi.container.servlet.ServletContainer.getDefaultResourceConfig(ServletContainer.java:414) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.spi.container.servlet.ServletContainer.getDefaultResourceConfig(ServletContainer.java:581) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.spi.container.servlet.WebServletConfig.getDefaultResourceConfig(WebServletConfig.java:87) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:703) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
            .......

The same exception I get in the browser when calling my REST web service. Note that there have been no code or library or config changes in this project (which produces that WAR). I believe only the deployment environment was changed.

exception


Solution

  • As it usually happens an hour or two after asking here, I found the solution.

    The solution is to upgrade Jersey from 1.8 to some later version from the 1.x Jersey line.

    First I tried a minimalistic approach and upgraded to version 1.9 but that one had the same issue.

    So then I just upgraded to the latest version from the 1.x Jersey line (which is version 1.19.3 as of this moment). This solved the problem.