when the spring boot container is started, the following error occurs:
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.webjars.WebJarAssetLocator.findWebJars(WebJarAssetLocator.java:122)
The following method did not exist:
io.github.classgraph.Resource.getClasspathElementURI()Ljava/net/URI;
The method's class, io.github.classgraph.Resource, is available from the following locations:
jar:file:/C:/Users/X048833/.m2/repository/io/github/classgraph/classgraph/4.6.32/classgraph-4.6.32.jar!/io/github/classgraph/Resource.class
It was loaded from the following location:
file:/C:/Users/X048833/.m2/repository/io/github/classgraph/classgraph/4.6.32/classgraph-4.6.32.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of io.github.classgraph.Resource
the mvn dependency:tree -Dverbose command shows that the newest version 4.8.44 is omitted, instead the version 4.6.32 is used.
[INFO] +- org.springdoc:springdoc-openapi-ui:jar:1.1.49:compile
[INFO] | +- (org.springdoc:springdoc-openapi-core:jar:1.1.49:compile - omitted for duplicate)
[INFO] | +- org.webjars:swagger-ui:jar:3.24.0:compile
[INFO] | \- org.webjars:webjars-locator:jar:0.37:compile
[INFO] | +- org.webjars:webjars-locator-core:jar:0.41:compile (version managed from 0.39)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.28:compile - version managed from 1.7.7; omitted for duplicate)
[INFO] | | +- (io.github.classgraph:classgraph:jar:4.8.44:compile - omitted for conflict with 4.6.32)
+- org.springdoc:springdoc-openapi-core:jar:1.1.49:compile
[INFO] | +- org.springdoc:springdoc-openapi-common:jar:1.1.49:compile
[INFO] | | +- (org.springframework.boot:spring-boot-autoconfigure:jar:2.2.0.RELEASE:compile - version managed from 2.0.9.RELEASE; omitted for duplicate)
[INFO] | | +- (org.springframework:spring-web:jar:5.2.0.RELEASE:compile - version managed from 5.0.13.RELEASE; omitted for duplicate)
[INFO] | | +- io.swagger.core.v3:swagger-models:jar:2.0.10:compile
[INFO] | | | \- (com.fasterxml.jackson.core:jackson-annotations:jar:2.10.0:compile - version managed from 2.9.10; omitted for duplicate)
[INFO] | | +- io.swagger.core.v3:swagger-annotations:jar:2.0.10:compile
[INFO] | | +- io.swagger.core.v3:swagger-integration:jar:2.0.10:compile
[INFO] | | | +- io.github.classgraph:classgraph:jar:4.6.32:compile
Thanks for fixing this.
Hi,
Coudl you please review your application dependencies: Your commande, shows that you load springdoc-openapi-core twice.
[INFO] | +- (org.springdoc:springdoc-openapi-core:jar:1.1.49:compile - omitted for duplicate)
You have a look, on the demos for the usage:
On springdoc-openapi-ui level: The last version of classgraph is all time loaded.
Here is an attachment of the command mvn dependency:tree -Dverbose result.
out.log
If you still have the issue, you can attach the sample code to reproduce it.
It looks like springdoc-openapi-ui depends on springdoc-openapi-core to include correct version of io.github.classgraph. But in version 1.1.49 an accident happened and springdoc-openapi-ui for some reason assumes newer version of that dependency, which is not there.
I'm sure guys will update it in next release. For now it can be fixed by simply excluding and forcing the dependency like this:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-core</artifactId>
<version>1.1.49</version>
<exclusions>
<exclusion>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.1.49</version>
</dependency>
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.44</version>
</dependency>
Same issue with spring webflux core, fixed as follows
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.63</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webflux-core</artifactId>
<version>1.2.30</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webflux-ui</artifactId>
<version>1.2.30</version>
</dependency>
@Simbosan,
springdoc-openapi-webflux-core is included by transitivity when you declare springdoc-openapi-webflux-ui.
Please note, that declaring the following is enough for a project :
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webflux-ui</artifactId>
<version>1.2.31</version>
</dependency>
If you are facing any dependencies problem, you can add the link to a simple demo project to reproduce it.
Thanks very much for the quick response. That removes the need for the workaround as well. Presumably there's a subtle dependency issue there but it's obviously a minor one
Most helpful comment
It looks like
springdoc-openapi-uidepends onspringdoc-openapi-coreto include correct version ofio.github.classgraph. But in version1.1.49an accident happened andspringdoc-openapi-uifor some reason assumes newer version of that dependency, which is not there.I'm sure guys will update it in next release. For now it can be fixed by simply excluding and forcing the dependency like this: