修改Corda Java模板项目后执行gradlew deployNodes报错求助
问题:Gradle部署Corda节点时出现序列化白名单配置错误
我下载了Corda Java版CorDapp模板项目,每次修改项目后执行gradlew deployNodes都会出现如下错误,但重启系统后问题会自动解决。请问我遗漏了什么内容吗?
> Configure project : Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0 at build_d668pifueefmtb65xfqnh374z$_run_closure5.doCall(C:\Users\amit.pamecha\Documents\workspace\abcdwork\capital-coin\cordapp-template-java\build.gradle:83) The setTestClassesDir(File) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the setTestClassesDirs(FileCollection) method instead. at build_d668pifueefmtb65xfqnh374z$_run_closure5.doCall(C:\Users\amit.pamecha\Documents\workspace\abcdwork\capital-coin\cordapp-template-java\build.gradle:83) > Task :deployNodes Bootstrapping local network in C:\Users\amit.pamecha\Documents\workspace\abcdwork\capital-coin\cordapp-template-java\build\nodes Node config files found in the root directory - generating node directories Generating directory for Notary Generating directory for PartyA Generating directory for PartyB Nodes found in the following sub-directories: [Notary, PartyA, PartyB] Waiting for all nodes to generate their node-info files... Distributing all node info-files to all nodes Gathering notary identities FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':deployNodes'. > net.corda.core.serialization.SerializationWhitelist: Error reading configuration file * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. * Get more help at https://help.gradle.org BUILD FAILED in 26s 12 actionable tasks: 4 executed, 8 up-to-date
解决建议
这种时好时坏的问题基本都是缓存冲突或者临时配置异常导致的,结合错误日志里的关键提示,给你几个不用重启系统就能解决的方案:
清理Gradle缓存与守护进程
重启系统本质上是清理了残留的Gradle进程和临时缓存,你可以手动完成这件事:- 执行
gradlew clean清理项目的构建输出文件 - 删除项目根目录下的
.gradle文件夹(这是Gradle的本地缓存目录) - 执行
gradlew --stop终止所有后台运行的Gradle守护进程 - 重新运行
gradlew deployNodes试试
- 执行
检查序列化白名单配置文件
错误日志里明确提到了SerializationWhitelist: Error reading configuration file,大概率是你修改项目时不小心改动了序列化白名单的配置文件(比如serialization-whitelist.conf),可能是语法错误、字符编码问题或者文件损坏:- 打开项目中相关的配置文件,检查是否符合HOCON语法规范
- 如果不确定哪里出错了,直接从原始的CorDapp模板里复制一份正确的配置文件替换掉当前的
修复Gradle版本兼容性问题
日志里还有Gradle 5.0的废弃警告,说明当前项目使用的Gradle版本和Corda模板存在兼容隐患:- 打开
gradle/wrapper/gradle-wrapper.properties文件,查看distributionUrl对应的Gradle版本 - 对照你使用的Corda版本,换成官方推荐的Gradle版本,然后重新执行构建
- 打开
内容的提问来源于stack exchange,提问作者Amit Pamecha
相关产品推荐
相关产品推荐

