UnsupportedClassVersionError when running on Java 8
hiji opened this issue · 2 comments
Description
In a Java 8 environment, registering a Logbook with the JAX-RS client (implemented in Jersey) and sending a request generated an UnsupportedClassVersionError.
In the README, following is written as Dependencies.
Java 8 (for Spring 6 / Spring Boot 3 Java 17 is required)
After investigating the cause, it seems that Paguro:3.10.3
, on which logbook-api
depends, is compiled with Java 11.
Is Java 11 required to use Logbook?
java.lang.UnsupportedClassVersionError: org/organicdesign/fp/collections/ImSortedMap has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:425)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at org.zalando.logbook.HttpHeaders.empty(HttpHeaders.java:79)
at org.zalando.logbook.HttpHeaders.of(HttpHeaders.java:87)
at org.zalando.logbook.jaxrs.LocalRequest.getHeaders(LocalRequest.java:145)
at org.zalando.logbook.Cache.lambda$get$0(Cache.java:16)
at java.util.concurrent.atomic.AtomicReference.updateAndGet(AtomicReference.java:179)
at org.zalando.logbook.Cache.get(Cache.java:15)
at org.zalando.logbook.CachingHttpRequest.getHeaders(CachingHttpRequest.java:20)
at org.zalando.logbook.FilteredHttpRequest.<init>(FilteredHttpRequest.java:30)
at org.zalando.logbook.DefaultLogbookFactory.lambda$combine$2(DefaultLogbookFactory.java:63)
at org.zalando.logbook.RequestFilter.lambda$merge$1(RequestFilter.java:19)
at org.zalando.logbook.DefaultLogbook.process(DefaultLogbook.java:38)
at org.zalando.logbook.DefaultLogbook.process(DefaultLogbook.java:27)
at org.zalando.logbook.jaxrs.LogbookClientFilter.filter(LogbookClientFilter.java:35)
at org.glassfish.jersey.client.ClientFilteringStages$RequestFilteringStage.apply(ClientFilteringStages.java:144)
at org.glassfish.jersey.client.ClientFilteringStages$RequestFilteringStage.apply(ClientFilteringStages.java:132)
at org.glassfish.jersey.process.internal.Stages.process(Stages.java:147)
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:297)
Expected Behavior
Log output when sending HTTP request with JAX-RS client.
Actual Behavior
UnsupportedClassVersionError is thrown when sending HTTP request with JAX-RS client.
Possible Fix
Steps to Reproduce
- Set
java.version
to1.8
in Maven project. - Send HTTP request with JAX-RS client (implemented by Jersery) that has registered Logbook.
Context
I want to use Logbook in project that uses Java 8.
Your Environment
- Version used: 2.16.0
- Link to your project:
I'll try to remove Paguro from project. Please note that changes will be applied to version 3. (To be released soon)