gpt4 book ai didi

java.lang.NoSuchMethodError : javax.validation.BootstrapConfiguration.getClockProviderClassName()Ljava/lang/String;

转载 作者:太空宇宙 更新时间:2023-11-04 09:57:03 28 4
gpt4 key购买 nike

使用 cordapp-templete-java 创建 cordaapp。启动 starter.java 时,我们收到“java.lang.NoSuchMethodError: javax.validation.BootstrapConfiguration.getClockProviderClassName()Ljava/lang/String;”错误。

Starter.java:

@SpringBootApplication
public class Starter {
/**
* Starts our Spring Boot application.
*/
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Starter.class);
app.setBannerMode(Banner.Mode.OFF);
app.setWebApplicationType(SERVLET);
app.run(args);
}
}

build.gradle:

apply plugin: 'java'
apply plugin: 'org.springframework.boot'

sourceSets {
main {
resources {
srcDir rootProject.file("config/dev")
}
}
}

dependencies {
// Corda dependencies.
compile "$corda_release_group:corda-rpc:$corda_release_version"

// CorDapp dependencies.
compile project(":cordapp-contracts-states")
compile project(":cordapp")

compile("org.springframework.boot:spring-boot-starter-websocket:$spring_boot_version") {
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"

}
compile('org.springframework.boot:spring-boot-starter-data-jpa') {
exclude(module: 'hibernate-validator')
}

/*compile("org.springframework.boot:spring-boot-starter-websocket") {
exclude module: "spring-boot-starter-tomcat"
}*/

compile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}"
compile "org.apache.logging.log4j:log4j-web:${log4j_version}"
compile "org.slf4j:jul-to-slf4j:$slf4j_version"

// https://mvnrepository.com/artifact/javax.validation/validation-api
// compile group: 'javax.validation', name: 'validation-api', version: '1.0.0.GA'
// compile group: 'javax', name: 'javaee-api', version: '8.0'
// implementation 'org.hibernate.validator:hibernate-validator:6.0.13.Final'





}

tasks.withType(JavaCompile) {
options.compilerArgs << "-parameters" // Required by Corda's serialisation framework.
}

springBoot {
mainClassName = "com.template.webserver.Server"
}

task runTemplateClient(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'com.template.Client'
args 'localhost:10006', 'user1', 'test'
}

task runTemplateServer(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'com.template.webserver.Starter'
args '--server.port=10050', '--config.rpc.host=localhost', '--config.rpc.port=10006', '--config.rpc.username=user1', '--config.rpc.password=test'
}

build.gradle:(主)

    buildscript {
ext {
corda_release_group = 'net.corda'
corda_release_version = '3.3-corda'
corda_gradle_plugins_version = '3.2.1'
junit_version = '4.12'
quasar_version = '0.7.9'
spring_boot_version = '2.0.2.RELEASE'
spring_boot_gradle_plugin_version = '2.0.2.RELEASE'
slf4j_version = '1.7.25'
log4j_version = '2.9.1'
}

repositories {
mavenLocal()
mavenCentral()
jcenter()
}

dependencies {
classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version"
classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version"
classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version"
classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_gradle_plugin_version"
}
}

allprojects {
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url 'https://ci-artifactory.corda.r3cev.com/artifactory/corda' }
maven { url 'https://jitpack.io' }
}
}

apply plugin: 'java'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'net.corda.plugins.quasar-utils'

sourceSets {
main {
resources {
srcDir rootProject.file("config/dev")
}
}
}

dependencies {
testCompile "junit:junit:$junit_version"

// Corda dependencies.
cordaCompile "$corda_release_group:corda-core:$corda_release_version"
cordaCompile "$corda_release_group:corda-node-api:$corda_release_version"
cordaRuntime "$corda_release_group:corda:$corda_release_version"

// CorDapp dependencies.
cordapp project(":cordapp")
cordapp project(":cordapp-contracts-states")

cordaCompile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}"
cordaCompile "org.apache.logging.log4j:log4j-web:${log4j_version}"
cordaCompile "org.slf4j:jul-to-slf4j:$slf4j_version"

compile group: 'javax', name: 'javaee-api', version: '8.0'
implementation 'org.hibernate.validator:hibernate-validator:6.0.13.Final'
}

tasks.withType(JavaCompile) {
options.compilerArgs << "-parameters" // Required by Corda's serialisation framework.
}

task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
directory "./build/nodes"
node {
name "O=Notary,L=London,C=GB"
notary = [validating : true]
p2pPort 10002
rpcSettings {
address("localhost:10003")
adminAddress("localhost:10043")
}
cordapps = [
"$project.group:cordapp-contracts-states:$project.version",
"$project.group:cordapp:$project.version"
]
}
node {
name "O=PartyA,L=London,C=GB"
p2pPort 10005
rpcSettings {
address("localhost:10006")
adminAddress("localhost:10046")
}
cordapps = [
"$project.group:cordapp-contracts-states:$project.version",
"$project.group:cordapp:$project.version"
]
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}
node {
name "O=PartyB,L=New York,C=US"
p2pPort 10008
rpcSettings {
address("localhost:10009")
adminAddress("localhost:10049")
}
cordapps = [
"$project.group:cordapp-contracts-states:$project.version",
"$project.group:cordapp:$project.version"
]
rpcUsers = [[ user: "user1", "password": "test", "permissions": ["ALL"]]]
}
}

请帮助启动 Spring Boot 服务器。

最佳答案

如果删除 Corda 上的所有依赖项,您的 Spring Boot 服务器是否会启动?

看起来您从 jpa 组件中排除了 hibernate-validator 的特定版本,然后不将其添加回 spring-boot 模块的依赖项中。

关于java.lang.NoSuchMethodError : javax.validation.BootstrapConfiguration.getClockProviderClassName()Ljava/lang/String;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53995087/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com