0

I upgraded my applications spring-boot-starter-parent version to 2.7.10.

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.10</version>
</parent>

<properties>
   <java.version>1.8</java.version>
<properties>

Along with this I integrated my app to OpenApi for which I added dependency like this

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-ui</artifactId>
    <version>1.6.8</version>
    <type>pom</type>
</dependency>

After this I'm able to access my swagger here http://localhost:8080/v3/api-docs but I can see it as JSON response. To get the typical swagger ui page I was recommended to add below dependency while removing the springdoc-openapi-ui

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
    <version>2.0.0</version>
</dependency>

I even tried using below dependency yet I get the same error

<dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
        <version>2.0.0</version>
    </dependency>

Below is my Swagger configuration class

@Bean
public OpenAPI customOpenAPIConfig() {
    return new OpenAPI().info(buildInfo());
}

private Info buildInfo() {
    return new Info()
            .title("WTS-Config Shipper Preferences API")
            .description("Shipper Preference API to create rules");
}

Now when I run the app in local I'm getting below error

Caused by: java.lang.UnsupportedClassVersionError: org/springdoc/core/conditions/MultipleOpenApiSupportCondition has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

My project is currently using Java 1.8 and I'm running this app in IntelliJ IDEA and I made sure all the settings are set to Java8 including the compiler etc. In fact I do not have any other java versions installed in my mac.

My goal is to access the application with Swagger UI: http://localhost:8080/swagger-ui.html

sai23
  • 65
  • 1
  • 8
  • As per exception message seems `MultipleOpenApiSupportCondition` class was compiled using Java 17. Did you try running with JDK 17? – Arnau Aregall Jun 25 '23 at 16:46
  • @ArnauAregall My application is not compatible with JdK 17. In any case when I don't have JDK 17 installed how can it compile with that? – sai23 Jun 27 '23 at 03:05
  • I would try to run the application without IntelliJ using `mvn clean bootRun` to double check you run the app with the JDK. And also as we are on July 23 I strongly recommend you to upgrade your application to JDK 17 at least. – Arnau Aregall Jul 09 '23 at 12:32

0 Answers0