2017-11-15 17 views
0

カスタムコードをM13からV1にアップグレードした後に問題が発生しています。私は、ノードドライバを使ってノードを起動する小さなテストスイートを持っています。バージョン1にアップグレードした後、cordadevcakeys.jksファイルがnullであると思われる問題が発生します(下記のエラースタックを参照してください)。アップグレードするには、単純にビルドのgradleのリリースバージョンとグラプルプラグインのバージョンを0.13.0から1.0.0に変更しました。このエラーが発生する可能性のあるステップが不足しているかどうかはわかりません。私は最新のバージョン1のCordaプロジェクトをローカルに引き出しました - しかし、私はこのステップが必要ではないという印象を受けました。ノードドライバの起動問題V1

[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-例を見て持つことにより、運転者とノードを起動するための私の方法が正しいようで、それが働いていましたM13で

*編集、私の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() 
     } 
+0

gradleビルドファイルを投稿できますか?私はあなたが依存関係をアップグレードするのを忘れたかもしれないと思います。 – Jacob

+0

ノードドライバコードも投稿できますか? – joel

+0

@Jacob iveは私のgradleビルドファイルを投稿しました。テストからではなくソース内のメインファイルから実際に呼び出すので、ノードドライバをコンパイルするテストではありません。 –

答えて

0

あなたは(下のIntelliJを閉じ、Gradleのキャッシュをクリアする必要がありますMacでは~/.gradle)。

+0

を投稿しました。これで部分的に問題が解決しました。この問題にぶつかる他の人には、intellij(2017.1から2017.2にアップグレード)を完全にアンインストールし、すべてのgradleキャッシュを削除し、コード・アプリケーションのローカルコピーを削除してリポジトリから再呼び出しする必要がありました。これを行い、gradleプロジェクトを再インポートした後、すべて正常に動作します。 –