swagger-api / swagger-api/swagger-core

Java 21 support for swagger-core?

Open
#4,765 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog
Dominant language
Java
Stars
7.5k
Forks
2.3k
Avg merge
18h 1m
Merged PRs (30d)
10

Description

I updated my application to support java 21. In that, all the javax.servlet.* imports were changed to jakarta. After this, I started seeing this error in swagger:
Failed to load API definition: response status is 500 /aps/openapi/openapi.json

The application logs are showing this error:
org.apache.catalina.core.StandardWrapperValve.invoke Allocate exception for servlet [OpenApi]
java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet

Similarly, I updated my application to use jakarta.xml.bind-api version 4.0.2 (which was 2.3.5 previously)

I found that the latest release of swagger-core currently relies on jakarta.xml.bind-api=2.3.3. Reverting my application back to this dependency version and imports resolves the issue.

However, moving forward, my application requires these changes. Could you let me know if there are plans to provide support for java 21, or if there's an alternative approach that would allow this compatibility?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure at /aps/openapi/openapi.json with Java 21 and the reported jakarta.xml.bind-api 4.0.2 dependency. Trace the OpenApi servlet failure and the javax.servlet.http.HttpServlet class loading error, then compare it with the working 2.3.5/2.3.3 dependency setup. Done means swagger-core supports the updated Jakarta dependencies without the 500 response.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.