运行简单的节点驱动程序时,NodeDriver有一个我从未见过的问题:
fun main(args: Array<String>) {
val rpcUsers = listOf(User("user1", "test", permissions = setOf("ALL")))
driver(DriverParameters(startNodesInProcess = true, waitForAllNodesToFinish = true)) {
startNode(providedName = CordaX500Name("PartyA", "London", "GB"), rpcUsers = rpcUsers).getOrThrow()
startNode(providedName = CordaX500Name("PartyB", "New York", "US"), rpcUsers = rpcUsers).getOrThrow()
}
}
当我在新的Kotlin模板cordapp项目中使用
Corda OS 4.1
运行它时,它可以正常工作。但是,当它在我们现有的cordapp中运行时,它最终会失败并显示以下内容:
java.lang.IllegalStateException: Unable to start notaries. A required port might be bound already.
at net.corda.testing.node.internal.DriverDSLImpl.start(DriverDSLImpl.kt:373) ~[corda-node-driver-4.1.jar:?]
at net.corda.testing.node.internal.DriverDSLImplKt.genericDriver(DriverDSLImpl.kt:966) ~[corda-node-driver-4.1.jar:?]
at net.corda.testing.driver.Driver.driver(Driver.kt:190) ~[corda-node-driver-4.1.jar:?]
at io.bluebank.braid.server.CordaAndBraidStandaloneKt.main(CordaAndBraidStandalone.kt:48) ~[test-classes/:?]
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1771) ~[?:1.8.0_212]
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915) ~[?:1.8.0_212]
at net.corda.core.internal.concurrent.CordaFutureImpl.get(CordaFutureImpl.kt) ~[corda-core-4.1.jar:?]
at net.corda.core.internal.concurrent.CordaFutureImplKt.get(CordaFutureImpl.kt:172) ~[corda-core-4.1.jar:?]
at net.corda.core.utilities.KotlinUtilsKt.getOrThrow(KotlinUtils.kt:134) ~[corda-core-4.1.jar:?]
at net.corda.testing.node.internal.DriverDSLImpl.start(DriverDSLImpl.kt:369) ~[corda-node-driver-4.1.jar:?]
对此进行调试,当我在阻止它的过程中断点时,所有线程都处于
WAIT
状态,除了称为SignalDispatcher
的一个RUNNING
之外。 Corda中都没有堆栈。但是,某些类在Quasar堆栈中处于阻塞状态。进一步调试,我发现了发生阻塞行为的行:
net.corda.node.services.rpc.ArtemisRpcBroker.kt:74
val serverConfiguration = RpcBrokerConfiguration(baseDirectory, maxMessageSize, jmxEnabled, addresses.primary, adminAddressOptional, sslOptions, useSsl, nodeConfiguration, shouldStartLocalShell)
进入该构造函数后,Quasar接管并似乎反复调用
ClassLoader.checkPackageAccess
。允许 call 继续,它永远不会输入RpcBrokerConfiguration#init
。之前是否有其他人看到过这种情况,是否有解决此问题的建议或关于如何进一步调试的线索?谢谢。
PS-此引用Corda errorCode
1crywct
。 最佳答案
FWIW,我将检查使用相同端口的其他进程,或者仅通过节点驱动程序更改端口。例如,Intellij随附的YourKit默认在端口10001上运行,即在默认的节点驱动程序公证端口上运行-好吧,假设我没记错的话。
关于corda - 节点驱动程序挂起并超时,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59093385/