Migration of a Jersey based Spring rest project to Java 11

Viewed 59

I have to migrate a rest web application to Java 11. I know, it is not trivial and I found out there many related posts. But, somehow none of them is my case.

The application is in use and runs in a Apache Tomcat 8.5.75 with Openjdk 1.8.0.222-2.b10.

Now, just simple deploying the application into an Apache Tomcat 9.0.58 with Eclipse Adoptium 11.0.14.1, the servlets are throwing java.lang.IllegalArgumentExceptions:

10-Jun-2022 08:13:45.840 SEVERE [main] org.apache.catalina.core.ApplicationContext.log Servlet.init() for servlet [RestOxServlet] threw exception
        java.lang.IllegalArgumentException
                at jersey.repackaged.org.objectweb.asm.ClassReader.<init>(ClassReader.java:170)
                ...

Such a servlet looks like this:

    <servlet>
        <servlet-name>RestOxServlet</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>
                mx.ox;
                mx.common.ox
            </param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
            <param-value>
                mx.ox.rest.Log4jServiceLoggingFilter;
                mx.common.ox.servicelogging.filter.ServiceLoggerServerFilter
            </param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
            <param-value>
                my.ox.rest.Log4jServiceLoggingFilter;
                mx.common.ox.servicelogging.filter.ServiceLoggerServerFilter
            </param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.config.feature.logging.DisableEntitylogging</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>com.sun.jersey.config.feature.XmlRootElementProcessing</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

The use libraries are:

com.sun.jersey.contribs:jersey-apache-client4:jar:1.19.4:compile
com.sun.jersey.contribs:jersey-apache-client:jar:1.19.4:compile
com.sun.jersey.contribs:jersey-multipart:jar:1.19.4:compile
com.sun.jersey.contribs:jersey-spring:jar:1.19.4:test
com.sun.jersey:jersey-client:jar:1.19.4:compile
com.sun.jersey:jersey-core:jar:1.19.4:compile
com.sun.jersey:jersey-server:jar:1.19.4:compile
com.sun.jersey:jersey-servlet:jar:1.19.4:compile

It is know that with Java 11 many of those classes/packages vanished from JDK. Who has already solved this kind of problem? Is there an equivalency table with all dependencies for Java 11?

SK

0 Answers
Related