gpt4 book ai didi

gradle - 为什么我的 deploy1Node 任务失败并提示 java.lang.ClassCastException : sun. nio.fs.UnixPath can be cast to java.lang.String?

转载 作者:行者123 更新时间:2023-12-03 05:38:48 25 4
gpt4 key购买 nike

我有一个工作的corda gradle构建。我们的 deploy1Node任务通过 IntelliJ、Windows 中的 cmd 和 MacOS 中的 iTerm 正常工作。

我们正在为此特定构建使用corda-3.2 开源( net.corda:corda-3.2:... )。
3.3 开源也会出现这个问题,并且
ubuntu 上的 Oracle java 版本“1.8.0_171”,mac 上的 Oracle java 版本“1.8.0_152”。

当我尝试在 Linux 机器中执行它时,收到以下错误
Caused by: java.lang.ClassCastException: sun.nio.fs.UnixPath cannot be cast to java.lang.String
如下面的堆栈跟踪摘录所示:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':deploy1Node'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
...
...
Caused by: java.lang.ClassCastException: sun.nio.fs.UnixPath cannot be cast to java.lang.String
at net.corda.nodeapi.internal.network.NetworkBootstrapper.generateWhitelist(NetworkBootstrapper.kt:323)
at net.corda.nodeapi.internal.network.NetworkBootstrapper.bootstrap(NetworkBootstrapper.kt:85)
at net.corda.plugins.Baseform.bootstrapNetwork(Baseform.kt:160)
at net.corda.plugins.Cordform.build(Cordform.kt:66)
...
...

无论平台如何,如何使此任务工作?

开源jar版本是:
Corda-Revision: 5ae8325980ad22df8146b983afeaca344fc03c3e
Corda-Vendor: Corda Open Source
Corda-Release-Version: 3.2-corda

企业版好像没问题:
Corda-Revision: c9b23a4400923a5cfe88271ce2fedd75740eac40
Corda-Vendor: Corda Enterprise Edition
Corda-Release-Version: 3.1

试图追踪这个问题,我发现在企业版中
它显示在 gradle 版本中:
> Task :deploy1Node
Putting task artifact state for task ':deploy1Node' into context took 0.0 secs.
Executing task ':deploy1Node' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
Running Cordform task
Deleting ./build/nodes
Bootstrapping local test network in /mnt/builds/Cordapp/appname/build/nodes
Generating node directory for Node
Copying CorDapp JARs into node directories

在开源版本中,输出为:
> Task :deploy1Node
Putting task artifact state for task ':deploy1Node' into context took 0.0 secs.
Executing task ':deploy1Node' (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs.
Running Cordform task
Deleting ./build/nodes
Bootstrapping local network in /mnt/builds/Cordapp/appname/build/nodes
Node config files found in the root directory - generating node directories
Generating directory for Node_node
Nodes found in the following sub-directories: [Node_node]

好像是 _node被附加到它不应该的地方。

在俄罗斯网站上还有另一个关于此问题的引用:
http://qaru.site/questions/16922067/why-does-my-deploy1node-task-fails-complaining-about-javalangclasscastexception-sunniofsunixpath-cannot-be-cast-to-javalangstring

最佳答案

分享解决方案并回答我自己的问题,为防止出现此问题,请确保您的 ext.corda_release_group , ext.corda_release_versionext.corda_gradle_plugins_version
在任何 buildscript 中定义一次且仅一次 session 您的
项目恰好有。

问题是由于试图获取 build.gradle 引起的。选择
2 种不同的corda 发行版(开源和企业版)——并在首次使用后更改默认选择。对于 open source , build.gradlebuildscript部分必须具有如下设置:

buildscript {
...
ext.corda_release_group = 'net.corda'
ext.corda_release_version = '3.2-corda'
ext.corda_gradle_plugins_version = '3.0.9'
ext.kotlin_version = '1.2.50'
...

同样,对于企业版,设置必须如下:
buildscript {
...
ext.corda_release_group = 'com.r3.corda'
ext.corda_release_version = '3.1'
ext.corda_gradle_plugins_version = '4.0.25'
ext.kotlin_version = '1.2.50'
...

一旦被选中,引用就变得纠缠不清,而且 deploy1Node任务在开源版本中失败。

一种可能性是使用类似的东西:
buildscript {
...
ext.profile_name = "open-source"
switch(profile_name) {
case ~/enterprise/ :
ext.cdb_node_location = 'nodes-enterprise'
ext.corda_release_group = 'com.r3.corda'
ext.corda_release_version = '3.1'
ext.corda_gradle_plugins_version = '4.0.25'
ext.kotlin_version = '1.2.50'
break;
case ~/open-source/ :
ext.cdb_node_location = 'nodes'
ext.corda_release_group = 'net.corda'
ext.corda_release_version = '3.2-corda'
ext.corda_gradle_plugins_version = '3.0.9'
ext.kotlin_version = '1.2.50'
break;
default :
ext.cdb_node_location = 'nodes'
ext.corda_release_group = 'net.corda'
ext.corda_release_version = '3.2-corda'
ext.corda_gradle_plugins_version = '3.0.9'
ext.kotlin_version = '1.2.50'
break;
break;
}

关于gradle - 为什么我的 deploy1Node 任务失败并提示 java.lang.ClassCastException : sun. nio.fs.UnixPath can be cast to java.lang.String?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54325928/

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