节点驱动程序启动问题V1

时间:2017-11-15 03:00:41

标签: driver corda

将自定义cordapp从M13升级到V1后,我遇到了问题。我有一个小的测试套件,它使用节点驱动程序启动节点,升级到版本1后,我遇到的问题似乎是由cordadevcakeys.jks文件为空引起的(请参阅下面的错误堆栈)。要升级我只需将build gradle发行版和gradle插件版本从0.13.0更改为1.0.0 - 我不确定这里是否有一个我可能会导致此错误的步骤?我还在当地推出了最新版本的Corda项目 - 虽然我的印象是这一步不需要。

[ERROR] 12:45:26,017 [main] (Driver.kt:396) driver.DriverDSL.genericDriver - 
Driver shutting down because of exception
java.lang.ExceptionInInitializerError: null
at net.corda.testing.driver.DriverDSL.start(Driver.kt:796) ~[corda-node-driver-1.0.0.jar:?]
at net.corda.testing.driver.Driver.genericDriver(Driver.kt:393) [corda-node-driver-1.0.0.jar:?]
at net.corda.testing.driver.Driver.driver(Driver.kt:317) [corda-node-driver-1.0.0.jar:?]
at net.corda.testing.driver.Driver.driver$default(Driver.kt:314) [corda-node-driver-1.0.0.jar:?]
at src.DeploymentTestKt.main(DeploymentTest.kt:29) [main/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:65) [idea_rt.jar:?]
Caused by: java.lang.IllegalStateException: ClassLoader.getSystemRes…ates/cordadevcakeys.jks") must not be null
at net.corda.testing.TestConstants$DEV_CA$2.invoke(TestConstants.kt:72) ~[corda-test-utils-1.0.0.jar:?]
at net.corda.testing.TestConstants$DEV_CA$2.invoke(TestConstants.kt) ~[corda-test-utils-1.0.0.jar:?]
at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130) ~[kotlin-stdlib-1.1.4.jar:1.1.4]
at net.corda.testing.TestConstants.getDEV_CA(TestConstants.kt) ~[corda-test-utils-1.0.0.jar:?]
at net.corda.testing.CoreTestUtils.getTestPartyAndCertificate$default(CoreTestUtils.kt:145) ~[corda-test-utils-1.0.0.jar:?]
at net.corda.testing.CoreTestUtils.getBOC_IDENTITY(CoreTestUtils.kt:75) ~[corda-test-utils-1.0.0.jar:?]
at net.corda.testing.CoreTestUtils.getBOC(CoreTestUtils.kt:76) ~[corda-test-utils-1.0.0.jar:?]
at net.corda.testing.CoreTestUtils.<clinit>(CoreTestUtils.kt:77) ~[corda-test-utils-1.0.0.jar:?]
... 10 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:65)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.corda.testing.CoreTestUtils
at net.corda.testing.driver.ShutdownManager.shutdown(Driver.kt:505)
at net.corda.testing.driver.DriverDSL.shutdown(Driver.kt:627)
at net.corda.testing.driver.Driver.genericDriver(Driver.kt:399)
at net.corda.testing.driver.Driver.driver(Driver.kt:317)
at net.corda.testing.driver.Driver.driver$default(Driver.kt:314)
at src.DeploymentTestKt.main(DeploymentTest.kt:29)
... 5 more
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: Could not initialize class net.corda.testing.CoreTestUtils
at net.corda.testing.driver.ShutdownManager.shutdown(Driver.kt:505)
at net.corda.testing.driver.DriverDSL.shutdown(Driver.kt:627)
at net.corda.testing.driver.Driver$genericDriver$shutdownHook$1.invoke(Driver.kt:391)
at net.corda.testing.driver.Driver$genericDriver$shutdownHook$1.invoke(Driver.kt)
at net.corda.nodeapi.internal.ShutdownHookKt$addShutdownHook$hook$1.run(ShutdownHook.kt:15)
at java.lang.Thread.run(Thread.java:748)

如果需要,我可以发布我正在使用的代码来启动驱动程序,但是通过查看cordapp-example,看起来我启动驱动程序和节点的方法是正确的,并且它正在M13上工作。 / p>

*编辑,添加到我的gradle构建和节点驱动程序代码中

apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'maven-publish'
apply plugin: 'application'
apply plugin: 'net.corda.plugins.quasar-utils'

repositories {
    mavenLocal()
    jcenter()
    mavenCentral()
    maven { url 'https://dl.bintray.com/kotlin/exposed' }
    maven { url 'https://jitpack.io' }
}

sourceSets {
    main {
        resources {
            srcDir "../config/dev"
        }
    }
    test {
        resources {
            srcDir "../config/test"
        }
    }
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
    compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
    compileOnly "co.paralleluniverse:capsule:1.0.1"
    compile 'net.sourceforge.plantuml:plantuml:8039'

    testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
    testCompile "junit:junit:$junit_version"

    //Corda integration dependencies
    cordaCompile "net.corda:corda-core:$corda_release_version"
    cordaCompile "net.corda:corda-finance:$corda_release_version"
    cordaCompile "net.corda:corda-jackson:$corda_release_version"
    cordaCompile "net.corda:corda-jfx:$corda_release_version"
    cordaCompile "net.corda:corda-rpc:$corda_release_version"
    cordaCompile "net.corda:corda-node-api:$corda_release_version"
    cordaCompile "net.corda:corda-webserver-impl:$corda_release_version"
    cordaCompile "net.corda:corda-test-utils:$corda_release_version"
    testCompile "net.corda:corda-test-utils:$corda_release_version"
    cordaRuntime "net.corda:corda:$corda_release_version"
    cordaRuntime "net.corda:corda-webserver:$corda_release_version"
    cordaCompile "net.corda:corda-node-driver:$corda_release_version"
    //testCompile "net.corda:corda-node-driver:$corda_release_version"
    cordapp "net.corda:corda-finance:$corda_release_version"

//    cordaCompile "net.corda:corda-core:$corda_release_version"
//    cordaCompile "net.corda:corda-finance:$corda_release_version"
//    cordaCompile "net.corda:corda-jackson:$corda_release_version"
//    cordaCompile "net.corda:corda-rpc:$corda_release_version"
//    cordaCompile "net.corda:corda-node-api:$corda_release_version"
//    cordaCompile "net.corda:corda-webserver-impl:$corda_release_version"
//    cordaRuntime "net.corda:corda:$corda_release_version"
//    cordaRuntime "net.corda:corda-webserver:$corda_release_version"
//    testCompile "net.corda:corda-test-utils:$corda_release_version"
//    cordaCompile "net.corda:corda-node-driver:$corda_release_version"
//    testCompile "net.corda:corda-node-driver:$corda_release_version"



}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        languageVersion = "1.1"
        apiVersion = "1.1"
        jvmTarget = "1.8"
        javaParameters = true   // Useful for reflection.
    }
}

task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
    directory "./build/nodes"
    networkMap "CN=Controller,O=R3,OU=corda,L=London,C=UK"
    node {
        name "CN=Controller,O=R3,OU=corda,L=London,C=UK"
        advertisedServices = ["corda.notary.validating"]
        p2pPort 10002
        rpcPort 10003
        cordapps = ["secLendModel"]
    }
    node {
        name "CN=NodeA,O=NodeA,L=London,C=UK"
        advertisedServices = []
        p2pPort 10005
        rpcPort 10006
        webPort 10007
        cordapps = ["secLendModel"]
        rpcUsers = [[ user: "user1", "password": "test", "permissions": []]]
    }
    node {
        name "CN=NodeB,O=NodeB,L=New York,C=US"
        advertisedServices = []
        p2pPort 10008
        rpcPort 10009
        webPort 10010
        cordapps = ["secLendModel"]
        rpcUsers = [[ user: "user1", "password": "test", "permissions": []]]
    }
    node {
        name "CN=NodeC,O=NodeC,L=Paris,C=FR"
        advertisedServices = []
        p2pPort 10011
        rpcPort 10012
        webPort 10013
        cordapps = ["secLendModel"]
        rpcUsers = [[ user: "user1", "password": "test", "permissions": []]]
    }
}

// TODO: Make into gradle plugin without any references to Jython
task installJythonDeps(dependsOn: ['build']) {
    project.copy {
        from project.configurations.runtime
        into "build/jythonDeps"
    }
}

installJythonDeps.shouldRunAfter build

idea {
    module {
        downloadJavadoc = true // defaults to false
        downloadSources = true
    }
}

publishing {
    publications {
        jarAndSources(MavenPublication) {
            from components.java
            artifactId 'secLendModel'

            artifact sourceJar
            artifact javadocJar
        }
    }
}

task runTemplateClientRPC(type: JavaExec) {
    classpath = sourceSets.main.runtimeClasspath
    main = 'com.template.client.TemplateClientRPCKt'
    args 'localhost:10006'
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}  

这是我的节点驱动程序代码

fun runSimulation() {
        driver(portAllocation = PortAllocation.Incremental(20000), isDebug = false, startNodesInProcess = true, extraCordappPackagesToScan = listOf("com.secLendModel")) {
            //Normal Users
            val arnoldParams = NodeParameters(providedName = ARNOLD, rpcUsers = arrayListOf(stdUser))
            val barryParams = NodeParameters(providedName = BARRY, rpcUsers = arrayListOf(stdUser))
            val colinParams = NodeParameters(providedName = COLIN, rpcUsers = arrayListOf(stdUser))
            val arnold = startNode(defaultParameters = arnoldParams)
            val barry = startNode(defaultParameters = barryParams)
            val colin = startNode(defaultParameters = colinParams)

            //Special Users (i.e asset issuers and oracles)
            val notaryParams = NodeParameters(providedName = NOTARY, advertisedServices = setOf(ServiceInfo(ValidatingNotaryService.type)))
            val notary = startNode(defaultParameters = notaryParams)
            //Stock issuer AND stock price oracle
            val exchangeParams = NodeParameters(providedName = EXCHANGE, rpcUsers = arrayListOf(specialUser),
                    advertisedServices = MARKET.plus(ServiceInfo(PriceType.type)))
            val exchange = startNode(defaultParameters = exchangeParams)
            //Cash issuer
            val centralbankParams = NodeParameters(providedName = CENTRALBANK, rpcUsers = arrayListOf(specialUser),
                    advertisedServices = CURRENCIES)
            val centralBank = startNode(defaultParameters = centralbankParams)
//            val oracle = startNode(ORACLE, advertisedServices = setOf(ServiceInfo(PriceType.type)))

            notaryNode = notary.get()
            arnoldNode = arnold.get()
            barryNode = barry.get()
            colinNode = colin.get()
            exchangeNode = exchange.get()
            centralNode = centralBank.get()
//            oracleNode = oracle.get()
            startWebserver(arnoldNode)

            setUpNodes()
            simulateTransactions()
            waitForAllNodesToFinish()
        }

1 个答案:

答案 0 :(得分:1)

您需要关闭IntelliJ并清除您的gradle缓存(在Mac上的<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" > <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <section id="pricing-table"> <div class="row pricelistNew"> <div class="pricing"> <div class="col-md-4 col-sm-12 col-xs-12"> <div class="pricing-table"> <div class="pricing-header"> <p class="pricing-title myTitle">Easy Plan </p> <p class="pricing-rate">₹ 1000 <br><span>Including All Tax</span> </p> <a class="btn btn-custom payNow">Easy Plan</a> </div> <div class="pricing-list"> <ul> <li>Contacts details up to : 25</li> <li>Bonus Contact details up to : 2</li> <li>Area Master Assistance : No</li> <li>Contact details through sms : Yes</li> </ul> </div> </div> </div> <div class="col-md-4 col-sm-12 col-xs-12"> <div class="pricing-table"> <div class="pricing-header"> <p class="pricing-title myTitle">Cool Plan </p> <p class="pricing-rate">₹ 2000 <br><span>Including All Tax</span> </p> <a class="btn btn-custom payNow">Cool Plan</a> </div> <div class="pricing-list"> <ul> <li>Contacts details up to : 48</li> <li>Bonus Contact details up to : 4</li> <li>Area Master Assistance : Yes</li> <li>Contact details through sms : Yes</li> </ul> </div> </div> </div> <div class="col-md-4 col-sm-12 col-xs-12"> <div class="pricing-table"> <div class="pricing-header"> <p class="pricing-title myTitle">Free Plan </p> <p class="pricing-rate">₹ 0 <br><span>Including All Tax</span> </p> <a class="btn btn-custom payNow">Free Plan</a> </div> <div class="pricing-list"> <ul> <li>Contacts details up to : 5</li> <li>Bonus Contact details up to : 00</li> <li>Area Master Assistance : No</li> <li>Contact details through sms : Yes</li> </ul> </div> </div> </div> </div> </div> </section>下)。