Deploying WAR with multi-version jar fails

52 views Asked by At

I am currently constrained to JDK17. I build with maven and a dependency requires a further jar of jackson 2.15.0 which jar is a multi-release with versions for Java 11, 17 and 19. I am building a WAR file but when deploying to a (webprofile) server (TomEE 9.1.1, Glassfish v6.2.5), deployment fails with errors such as:

Exception while visiting META-INF/versions/19/com/fasterxml/jackson/core/io/doubleparser/FastIntegerMath.class of size 5112 java.lang.IllegalArgumentException: Unsupported class file major version 63

63 is Java 19, of course.

Glassfish 7.0.1 on the other hand, works, albeit it being very slow deploying (on localhost).

I read that modern servers can deal with MRjars (eg: latest jetty, glassfish etc.). I couldn't find any maven property (compiler source/target/release), exclude or enforcer (eg: requireJavaVersion) which worked so how do I successfully deploy my WAR on to my remote TomEE (if at all possible)?

1

There are 1 answers

4
bunicu2k4 On

Can you try if explicitly adding the dependency with provided scope works? It marks that the dependency should be provided by the container, therefore the server would use its own version which should work.

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.15.0</version>
    <scope>provided</scope>
</dependency>