question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

spring boot 2.2: newest classgraph is not loaded

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

14reactions
tomasjcommented, Dec 29, 2019

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>
2reactions
bnasslahsencommented, Feb 18, 2020

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error starting Springboot when update version to 2.7.0 "An ...
classgraph :classgraph but their versions are incompatible. Spring Boot's dependency management for webjars-core-locator uses version 0.50 .
Read more >
Getting Started Quickly, Easily and Reliably with Spring Boot ...
This guide walks you through building and running a simple Spring Boot, Apache Geode ClientCache application using the Spring Boot for Apache Geode...
Read more >
Hot-swap not working in Spring Boot application
I am out of ideas. I have followed these instructions: Intellij IDEA – Spring boot reload static file is not working and searched...
Read more >
Maintaining a medium-sized Java library in 2022 and beyond
Why not Bach? 2.1.4. Maven it is. 2.2. My Maven best practices. 2.2.1. ... Andy Wilkinson in "Migrating Spring Boot's Build to Gradle"....
Read more >
java.lang.NoSuchMethodError in java - Gatling Community
... but this is the funny thing → we are using java, not scala, ... /.m2/repository/org/springframework/boot/spring-boot-starter-json/2.4.7 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found