Swagger-core: Bug: Cannot access YAML: java.lang.NoSuchMethodError

Created on 13 Feb 2018  路  4Comments  路  Source: swagger-api/swagger-core

I am trying to use swagger-core for my JAX RS API, but when trying to access the openapi.yaml file (In my case http://localhost:8080/api/openapi.yaml) i'm getting the following error:
java.lang.NoSuchMethodError: com.google.common.collect.Sets$SetView.iterator()Lcom/google/common/collect/UnmodifiableIterator;
The API itself is working as expected. Am i missing something or is this a bug?

Technology
JEE 8
Glassfish 5
JAX-RS 2.26
Swagger-jaxrs2 2.0.0-rc4

Stacktrace
stacktrace.txt
POM.xml
pom.txt
web.xml
web.txt

Most helpful comment

Weird. It seems i've forgot to add the xml code or it got deleted?
The Glassfish xml should contain this option:
<glassfish-web-app> <class-loader delegate="false"/> </glassfish-web-app>

All 4 comments

I finally found the solution.
Glassfish has its own Guava Version which is not compatible with Swagger.

To fix it:
Create a glassfish-web.xml
And add <class-loader delegate="false"/>

@denny99 add what? Seeing this issue too...

Weird. It seems i've forgot to add the xml code or it got deleted?
The Glassfish xml should contain this option:
<glassfish-web-app> <class-loader delegate="false"/> </glassfish-web-app>

I'm using spring boot with jersey.
I got the same error with the latest version of guava.
I could see that older version was clearly not getting added to the classpath.
So I tried multiple versions of guava. And the version that worked was com.google.guava:guava:24.1-jre ( <= 24.1-jre).

Was this page helpful?
0 / 5 - 0 ratings