zalando/logbook

UnsupportedClassVersionError when running on Java 8 and JAX-RS 2.X

hiji opened this issue · 2 comments

hiji commented

Description

In #1497 , I asked them to solve the problem that JAX-RS client cannot be used in Java 8 environment. thank you.

To apply this change, I upgraded Logbook version from 2.16.0 to 3.1.0, and now I get UnsupportedClassVersionError when new LogbookClientFilter.

java.lang.UnsupportedClassVersionError: jakarta/ws/rs/client/ClientRequestFilter 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

When I checked LogbookClientFilter of logbook-json, the version of implemented interface ClientRequestFilter was changed.

I would like to know if there is a way to use it in Java8 environment and JAX-RS 2.X.

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

  1. Set java.version to 1.8 in Maven project.
  2. Send HTTP request with JAX-RS client (implemented by Jersery) that has registered Logbook.

Your Environment

  • Version used: 3.1.0
  • Link to your project:

They used a dependency org.organicdesign.Paguro which is compiled against Java 11. So don't upgrade

@hiji The issue stems from the fact that the new Logbook (as of 3.x) switched to JAX-RS 3.x, but the documentation is not updated to reflect this. However, it was rather easy to add the support back.

PR #1674 should fix the issue. I've also created a proof of concept project that shows how things work. It will be great to receive your feedback.

@iwangbowen

They used a dependency org.organicdesign.Paguro which is compiled against Java 11. So don't upgrade

This was actually the case in 3.0.0 Release Candidates, but as per this issue #1497, Paguro was removed from 3.0.0 onwards.