![](/img/trans.png)
[英]Error: Unable to initialize main class files.Main Caused by: java.lang.NoClassDefFoundError: Stage
[英]Corda - Unable to initialize main class Capsule (Caused by: java.lang.NoClassDefFoundError: java/lang/instrument/Instrumentation)
我正在嘗試瀏覽Corda Hello世界示例 (特別是Java版本)。
我到了應該部署節點的地步,但是失敗了:
> ./gradlew clean 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_9ngc7dap6wdyi5igmry41f6s9$_run_closure5.doCall(/home/foo/cordapp-template-java/build.gradle:85)
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_9ngc7dap6wdyi5igmry41f6s9$_run_closure5.doCall(/home/foo/cordapp-template-java/build.gradle:85)
> Task :deployNodes
Bootstrapping local network in /home/foo/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: [PartyB, PartyA, Notary]
Waiting for all nodes to generate their node-info files...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':deployNodes'.
> Node in PartyB exited with 1 when generating its node-info - see logs in /home/foo/cordapp-template-java/build/nodes/PartyB/logs
* 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 3s
15 actionable tasks: 15 executed
建議在/home/foo/cordapp-template-java/build/nodes/PartyB/logs
中查看/home/foo/cordapp-template-java/build/nodes/PartyB/logs
,其中包含文件node-info-gen.log
內容如下:
Error: Unable to initialize main class Capsule
Caused by: java.lang.NoClassDefFoundError: java/lang/instrument/Instrumentation
PartyA和Notary日志中也存在相同的錯誤。
此錯誤的原因可能是什么?
為了確保我不會意外添加導致此的更改,我刪除了更改並按原樣使用了模板項目:
> git status
On branch release-V3
Your branch is up-to-date with 'origin/release-V3'.
nothing to commit, working directory clean
> git branch -v
* release-V3 c9eed90 Reducing dependency on Jitpack by depending on new repository that is a combination of corda-releases and corda-dependencies (#37)
> java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-0ubuntu0.16.04.1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
我也嘗試使用Oracle JDK,但結果完全相同。
> /usr/lib/jvm/java-8-oracle/bin/java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
在運行deployNodes時,我認為您不應該運行干凈任務。
1. ./gradlew clean build
2../gradlew deployNodes
它應該工作。
看來我的環境有問題。
重新安裝Java后,問題消失了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.