버전을 2.7.0으로 업데이트할 때 Springboot을 시작하는 중 오류 발생 "존재하지 않는 메서드를 호출하려고 했습니다."
Springboot 버전을 2.7.0으로 업데이트했는데 오류가 반환된 후:
설명:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.webjars.WebJarAssetLocator.scanForWebJars(WebJarAssetLocator.java:183)
The following method did not exist:
'io.github.classgraph.ClassGraph io.github.classgraph.ClassGraph.acceptPaths(java.lang.String[])'
The calling method's class, org.webjars.WebJarAssetLocator, was loaded from the following location:
jar:file:/home/gabriel/.m2/repository/org/webjars/webjars-locator-core/0.50/webjars-locator-core-0.50.jar!/org/webjars/WebJarAssetLocator.class
The called method's class, io.github.classgraph.ClassGraph, is available from the following locations:
jar:file:/home/gabriel/.m2/repository/io/github/classgraph/classgraph/4.8.69/classgraph-4.8.69.jar!/io/github/classgraph/ClassGraph.class
The called method's class hierarchy was loaded from the following locations:
io.github.classgraph.ClassGraph: file:/home/gabriel/.m2/repository/io/github/classgraph/classgraph/4.8.69/classgraph-4.8.69.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.webjars.WebJarAssetLocator and io.github.classgraph.ClassGraph
이것은 나의 pom.xml입니다.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>re.brasuka</groupId>
<artifactId>bra</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>gto</name>
<description>Projeto do BRASUKA</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>2021.0.3-SNAPSHOT</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<!-- Lib para Serealizar e Desserealizar Json -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<!-- Lib para acesso a servidor SFTP-->
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<!-- Lib para converte arquivo em objeto -->
<dependency>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
<version>2.9.0</version>
</dependency>
<!-- Documentação -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.4.8</version>
</dependency>
<!-- Registri e Gateway -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!-- Client FTP -->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
</dependency>
<!-- Criação de Json para retornos -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20201115</version>
</dependency>
<!-- Para gerar PDF -->
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.22</version>
</dependency>
<!-- Starter do Spring para envio de email -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
제가 이걸 고칠 수 있을까요?
의 전이적 의존성에는 비호환성이 있습니다.org.springdoc:springdoc-openapi-ui
두 가지 모두에 따라 다릅니다.org.webjars:webjars-core-locator
그리고.io.github.classgraph:classgraph
버전이 호환되지 않습니다.
Spring Boot의 종속성 관리:webjars-core-locator
버전 사용0.50
.webjars-core-locator
0.50
을 사용합니다.classgraph
4.8.139
기본적으로 하지만 메이븐이 버전 충돌을 해결하는 방식 때문에 다운그레이드됩니다.4.8.69
.
의 사용을 복원하여 문제를 해결할 수 있습니다.4.8.139
일부 종속성 관리를 추가함으로써pom.xml
당신의 기존 수입품과 함께spring-cloud-dependencies
:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.139</version>
</dependency>
</dependencies>
</dependencyManagement>
build.gradle 파일에 다음 구현을 추가하면 문제가 해결됩니다. ('org.springdoc:springdoc-openapi-ui:1.6.9')
다른 답변에서 언급했듯이, 여기서 문제를 일으키는 것은 정말 springdoc-openapi-ui입니다.저는 WebJarAssetLocator 및/또는 ClassGraph와 관련하여 다양한 오류가 있었는데, 둘 다 springdoc 업데이트를 통해 해결되었습니다.
이제 spring-boot 2.7.2와 spring-doc 1.6.9로 모든 것이 다시 원활하게 실행됩니다.
springdoc-openapi-ui를 1.6.12로 업그레이드하는 것으로 수정했습니다.
코드 샘플과 함께 2파운드를 추가하는 중입니다.기존 프로젝트를 Spring boot 2.7.5로 업그레이드하고 다음과 유사한 "경고"를 받았습니다.
"level":"WARN","thread":"main","logger":"org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext","message":"Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException:
....
nested exception is java.lang.NoSuchMethodError: 'io.github.classgraph.ClassGraph io.github.classgraph.ClassGraph.acceptPaths(java.lang.String[])'","context":"default"}
앱이 시작되지 않도록 했습니다.
업데이트했습니다.org.springdoc
버전을 이 페이지와 같이 최신 버전으로 변경하고 오류를 수정했습니다.https://springdoc.org/ #spring-webflux-support
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webflux-ui</artifactId>
<version>1.6.12</version>
</dependency>
언급URL : https://stackoverflow.com/questions/72397763/error-starting-springboot-when-update-version-to-2-7-0-an-attempt-was-made-to-c
'sourcecode' 카테고리의 다른 글
mongodb에 단일 쿼리가 있는 다중 카운트 (0) | 2023.07.03 |
---|---|
MongoDB에서 제약 조건을 적용하는 방법은 무엇입니까? (0) | 2023.07.03 |
Out Of Memory Error(Java)를 해결하는 방법: GC 오버헤드 제한이 r에서 초과됩니까? (0) | 2023.07.03 |
Vue TypeScript 프로젝트의 이벤트 유형은 무엇입니까? (0) | 2023.06.28 |
SQL이 where 절에서 열 별칭을 인식하지 못합니다. (0) | 2023.06.28 |