尝试调用不存在的方法。尝试是从以下位置进行的

问题描述 投票:0回答:1

您好,我正在从 Springboot 2.x.x 更改为 3.x.x。我的应用程序构建正常,但我在测试用例中发现了一些与流口水相关的问题,因此我尝试将 kie-ci 版本从 7.74.1 升级到 8 上的最新版本,但现在我的应用程序无法启动。这是错误

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.apache.maven.RepositoryUtils.toRepo(RepositoryUtils.java:213)

The following method did not exist:

    'org.eclipse.aether.repository.RemoteRepository$Builder org.eclipse.aether.repository.RemoteRepository$Builder.setBlocked(boolean)'

The calling method's class, org.apache.maven.RepositoryUtils, was loaded from the following location:

    jar:file:/Users/rf22/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-core/3.8.6/f945f1f19452214d360d453d9357275313f1cfd9/maven-core-3.8.6.jar!/org/apache/maven/RepositoryUtils.class

The called method's class, org.eclipse.aether.repository.RemoteRepository$Builder, is available from the following locations:

    jar:file:/Users/rf22/.gradle/caches/modules-2/files-2.1/org.eclipse.aether/aether-api/1.0.2.v20150114/839f93a5213fb3e233b09bfd6d6b95669f7043c0/aether-api-1.0.2.v20150114.jar!/org/eclipse/aether/repository/RemoteRepository$Builder.class
    jar:file:/Users/rf22/.gradle/caches/modules-2/files-2.1/org.apache.maven.resolver/maven-resolver-api/1.7.3/2602fc14676d79d1802dcc3bfcfb3628c598ee8/maven-resolver-api-1.7.3.jar!/org/eclipse/aether/repository/RemoteRepository$Builder.class

The called method's class hierarchy was loaded from the following locations:

    org.eclipse.aether.repository.RemoteRepository.Builder: file:/Users/rf22/.gradle/caches/modules-2/files-2.1/org.eclipse.aether/aether-api/1.0.2.v20150114/839f93a5213fb3e233b09bfd6d6b95669f7043c0/aether-api-1.0.2.v20150114.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.apache.maven.RepositoryUtils and org.eclipse.aether.repository.RemoteRepository$Builder

这是我的 build.gradle,当我使用旧版本的 kie-ci 时,它构建正常,但现在我遇到了上面的问题。我假设它试图从两个不同的位置调用该方法,但我不确定。有没有人有见解?

dependencies {
    //resilience4j
    implementation group: 'io.github.resilience4j', name: 'resilience4j-spring-boot3',   version: '2.2.0'
    implementation group: 'io.github.resilience4j', name: 'resilience4j-circuitbreaker', version: '2.2.0'
    implementation group: 'io.github.resilience4j', name: 'resilience4j-reactor',        version: '2.2.0'
    //web (Tomcat, Logging, Rest)
    implementation group: 'org.springframework.boot',   name: 'spring-boot-starter-web'
    // Redis
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis'
    //Mongo Starter
    implementation group: 'org.springframework.boot', name:'spring-boot-starter-data-mongodb'
    // Configuration processor - To Generate MetaData Files. The files are designed to let  developers offer "code completion" as users are working with application.properties
    implementation group: 'org.springframework.boot', name: 'spring-boot-configuration-processor'
    // Actuator - Monitoring
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'

    implementation group: 'org.kie', name: 'kie-ci', version: '8.44.0.Final'
\

    //Swagger
    //implementation group: 'io.springfox', name: 'springfox-swagger2', version:'3.0.0'
    //implementation group: 'io.springfox', name: 'springfox-swagger-ui', version:'2.7.0'
    // Migrated from Swagger2 SpringFox to SpringDoc OpenAPI - Upgrade to SpringBoot 2.7.18 - Dec 2023
    implementation group: 'org.springdoc',           name: 'springdoc-openapi-starter-webmvc-ui', version: '2.5.0'
    implementation group: 'com.doctusoft', name: 'json-schema-java7', version: '1.4.1'
    implementation('com.google.code.gson:gson:2.8.6')
    implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.5.0-M2'
    implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
    implementation group: 'org.apache.httpcomponents.client5', name: 'httpclient5', version: '5.3.1'
//  implementation group: 'com.google.guava', name: 'guava', version: '33.0.0-jre'
    implementation group: 'org.apache.maven', name: 'maven-aether-provider', version: '3.3.9'
    //Lombok
    compileOnly group: 'org.projectlombok', name: 'lombok', version:'1.18.26'
    annotationProcessor group:'org.projectlombok', name:'lombok',version:'1.18.26'
    implementation group: 'org.json', name: 'json', version: '20240303'
//  testCompileOnly 'org.projectlombok:lombok:1.18.12'
//  testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'

    //Sleuth - Tracing
    implementation('org.springframework.boot:spring-boot-starter-validation')
    //implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-sleuth'
    implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-bootstrap', version: '3.1.0'
    implementation group: 'org.mongodb', name: 'mongodb-driver-core', version: '5.0.0'
    implementation group: 'org.mongodb', name: 'mongodb-driver-sync', version: '5.0.0'
    implementation group: 'org.mongodb', name: 'bson', version: '5.0.0'
    //JSON Schema Validator
    implementation group: 'com.github.java-json-tools', name: 'json-schema-validator',
            version: '2.2.14'

    implementation group: 'jakarta.annotation', name: 'jakarta.annotation-api', version: '3.0.0'
    implementation('org.jacoco:jacoco-maven-plugin:0.8.0')
    // Cucumber dependencies (newer versions compatible with Spring Boot 3.x)
    implementation 'io.cucumber:cucumber-java:7.18.0'
    implementation group: 'io.cucumber', name: 'cucumber-spring', version: '7.18.0'
    testImplementation('io.cucumber:cucumber-spring:7.18.0')

    //Testing Embedded Redis
    testImplementation group: 'com.github.kstyrc', name: 'embedded-redis', version:'0.6'
    //Testing Embedded Mongo
    testImplementation 'de.flapdoodle.embed:de.flapdoodle.embed.mongo.spring3x:4.16.1'

    testImplementation group: 'net.javacrumbs.json-unit', name: 'json-unit', version: '1.31.1'
    testImplementation group: 'junit', name: 'junit', version: '4.13'
    testImplementation group: 'com.github.kstyrc', name: 'embedded-redis', version:'0.6'
    testImplementation group: 'org.springframework.ws', name: 'spring-ws-test', version:'2.4.0.RELEASE'
    testImplementation group: 'org.springframework.boot', name:'spring-boot-starter-test'
    testImplementation('io.cucumber:cucumber-java:7.13.0')
    testImplementation('io.cucumber:cucumber-junit:7.13.0')
    testImplementation('io.cucumber:cucumber-spring:7.13.0')
//  integrationTestImplementation("org.springframework.boot:spring-boot-starter-test"){
//      testImplementation('io.cucumber:cucumber-junit:7.13.0')
//      testImplementation('io.cucumber:cucumber-spring:7.13.0')
//  }
    implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.12.0'
}

java spring spring-boot maven
1个回答
0
投票

检查您使用的 kie-ci 版本与 maven-aether-provider 和 maven-resolver 版本之间的兼容性。您可能需要升级或降级其中之一以确保兼容性。 确保您没有混合不兼容的版本。例如,如果您使用 kie-ci 8.44.0,请检查其文档以获取 maven-aether-provider 和 maven-resolver 的兼容版本。

您还可以排除导致问题的特定版本..并包含兼容的新版本。

© www.soinside.com 2019 - 2024. All rights reserved.