java - AbstractMethodError:org.apache.bval.jsr303.ConfigurationImpl 缺少方法 getDefaultParameterNameProvider() 的定义

标签 java spring-boot gradle java-11 abstractmethoderror

我目前正在使用 JAVA 11 将 Spring Boot (2.1.5) 应用程序升级到 gradle 版本“5.4.1”。

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: Receiver class org.apache.bval.jsr303.ConfigurationImpl does not define or inherit an implementation of the resolved method abstract getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider; of interface javax.validation.Configuration.

相关依赖项:

hibernate 核心:5.4.3.Final

hibernate validator :6.0.17.Final

我尝试降级 hibernate-validator 并尝试显式指定 valid-api 的版本,但似乎没有任何效果。

构建.Gradle

buildscript {
    ext {
        springBootVersion = '2.1.5.RELEASE'
    }
    repositories {
        mavenCentral()
        jcenter()
        maven { url 'http://repo.spring.io/plugins-release' }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
compileJava {
    sourceCompatibility = '11'
    targetCompatibility = '11'
}
apply plugin: 'application'
apply plugin: 'maven'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.springframework.boot'
apply plugin: 'war'
apply plugin: 'idea'

mainClassName = 'io.app.ams.Application'

bootJar {
    mainClassName 'io.app.ams.Application'
    launchScript()
}

springBoot {
    mainClassName 'io.app.ams.Application'
    buildInfo()
}

bootRun {
    sourceResources sourceSets.main
}

apply from: 'liquibase.gradle'
apply from: 'gatling.gradle'

configurations {
    providedRuntime
}

defaultTasks 'bootRun'

repositories {
    mavenLocal()
    maven { url 'http://repo.spring.io/milestone' }
    maven { url 'http://repo.spring.io/snapshot' }
    maven { url 'https://repository.jboss.org/nexus/content/repositories/releases' }
    maven { url 'https://oss.sonatype.org/content/repositories/releases' }
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    maven { url 'http://repo.maven.apache.org/maven2' }

    flatDir {
        dirs 'libs'
    }
}

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-validation')
    testImplementation 'org.scalatest:scalatest_2.11:3.0.0'
    compile group: 'commons-httpclient', name: 'commons-httpclient', version: '3.1'
    compile group: 'io.dropwizard.metrics', name: 'metrics-core'
    compile group: 'io.dropwizard.metrics', name: 'metrics-graphite'
    compile group: 'io.dropwizard.metrics', name: 'metrics-healthchecks'
    compile group: 'io.dropwizard.metrics', name: 'metrics-jvm', version: dropwizard_metrics_version
    compile group: 'io.dropwizard.metrics', name: 'metrics-servlet', version: dropwizard_metrics_version
    compile group: 'io.dropwizard.metrics', name: 'metrics-json', version: dropwizard_metrics_version
    compile group: 'io.dropwizard.metrics', name: 'metrics-servlets'

    // kafka
    compile group: 'org.springframework.kafka', name: 'spring-kafka', version: kafka_version

    compile group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.18'

    compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-json-org', version: jackson_version
    compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hppc', version: jackson_version
    compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-joda'
    compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hibernate4', version: jackson_version
    compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jdk8'
    compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310'
    compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-parameter-names'

    compile(group: 'com.zaxxer', name: 'HikariCP', version: HikariCP_version) {
        exclude(module: 'tools')
    }

    compile group: 'org.apache.commons', name: 'commons-lang3', version: commons_lang_version
    compile group: 'commons-io', name: 'commons-io', version: commons_io_version
    compile group: 'javax.inject', name: 'javax.inject', version: javax_inject_version
    compile group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'

    compile group: 'joda-time', name: 'joda-time', version: '2.10.2'

    compile group: 'org.apache.geronimo.javamail', name: 'geronimo-javamail_1.4_mail', version: geronimo_javamail_1_4_mail_version

    compile group: 'org.hibernate', name: 'hibernate-core', version: '5.4.3.Final'
    compile group: 'org.hibernate.validator', name: 'hibernate-validator', version: '6.1.0.Alpha5'
    compile group: 'org.hibernate', name: 'hibernate-envers', version: '5.4.3.Final'
    compile group: 'org.hibernate', name: 'hibernate-ehcache' ,version: '5.4.3.Final'

    compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.2.Final'

    compile group: 'org.jadira.usertype', name: 'usertype.core', version: '7.0.0.CR1'

    compile group: 'org.springframework.boot', name: 'spring-boot-starter-parent', version: '2.1.6.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '2.1.6.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-properties-migrator', version: '2.1.6.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure'
    compile group: 'org.springframework.boot', name: 'spring-boot-loader-tools'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-logging'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-security'

    compile(group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.6.RELEASE')
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-websocket'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-velocity', version: '1.1.3.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-elasticsearch', version: '2.1.6.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-mongodb'

    compile group: 'org.springframework.cloud', name: 'spring-cloud-cloudfoundry-connector'
    compile group: 'org.springframework.cloud', name: 'spring-cloud-spring-service-connector'
    compile group: 'org.springframework.cloud', name: 'spring-cloud-localconfig-connector'
    compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-config', version: '2.1.3.RELEASE'
    compile group: 'org.springframework.cloud', name: 'spring-cloud-dependencies', version: 'Greenwich.RELEASE'
    compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-hystrix', version: '2.1.2.RELEASE'
    compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-netflix-zuul', version: '2.1.2.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot', version: '2.1.6.RELEASE'
    compile group: 'org.springframework', name: 'spring-context', version: '5.1.8.RELEASE'
    compile group: 'org.springframework', name: 'spring-context-support'

    compile group: 'org.springframework.security', name: 'spring-security-core', version: spring_security_version
    compile group: 'org.springframework.security', name: 'spring-security-config', version: spring_security_version
    compile group: 'org.springframework.security', name: 'spring-security-data', version: spring_security_version
    compile group: 'org.springframework.security', name: 'spring-security-web', version: spring_security_version
    compile group: 'org.springframework.security', name: 'spring-security-messaging', version: spring_security_version
    compile group: 'org.springframework.security', name: 'spring-security-acl', version: spring_security_version
    compile group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: spring_security_oauth2_version

    compile group: 'org.springframework.ws', name: 'spring-ws-core', version: '3.0.7.RELEASE'

    compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.16'
    compile group: 'com.h2database', name: 'h2'
    compile group: 'org.kairosdb', name: 'client', version: '3.0.0'
    compile group: 'org.projectlombok', name: 'lombok', version: lombok_version
    compile group: 'org.apache.commons', name: 'commons-lang3', version: commons_lang3_version
    compile group: 'commons-validator', name: 'commons-validator', version: commons_validator_version
    compile group: 'io.jsonwebtoken', name: 'jjwt', version: jjwt_version

    runtime "net.java.dev.jna:jna"

    optional "org.springframework.boot:spring-boot-configuration-processor"
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
        mavenBom 'org.springframework:spring-framework-bom:5.1.8.RELEASE'
    }
}

compileJava.dependsOn(processResources)

wrapper {
    gradleVersion = '5.4.1'
    distributionUrl = distributionUrl.replace("bin", "all")
}

最佳答案

该错误与 bval(apache bean 验证实现)相关,您的目标是 bean 验证 1.0。您可以将其升级到 bval-jsr 以实现 Bean 验证 1.1 实现,或者如果您想要 hibernate ,则排除/删除它。

旁注:如果你使用的是旧版,如果我没记错的话,它需要一些 system.properties 调整。

关于java - AbstractMethodError:org.apache.bval.jsr303.ConfigurationImpl 缺少方法 getDefaultParameterNameProvider() 的定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56786944/

相关文章:

java - 如何使用IP地址在Java中截屏

android - 使用 android.tools.lint 执行 JetifyTransform 失败

mongodb - 如何在不使用GridFSTemplate的情况下在spring boot应用程序中上传和检索mongodb中的文件?

java - Spring Boot 防止 "Port In use"

java - Gradle + OSGi Liferay7 模块,包括传递依赖项

android - 无法构建项目,gradle 有问题吗?

java - HTTP 请求是从 JSP 与 servlet 通信的唯一方法吗?

java - 有没有一种方法可以在 java 中读取 xml 文件而不必定义要读入的类

java - Drools:匹配规则 LHS 中数组中的本地字符串

java - spring boot 是否提供标准的登录和注册支持