corda / cordapp-template-kotlin

A Kotlin CorDapp Template. Extend it via the Hello, World tutorial: https://docs.corda.net/hello-world-introduction.html
119 stars 149 forks source link

Run configuration "Run Template Cordapp" fails to start #37

Open andrzejtokarski opened 6 years ago

andrzejtokarski commented 6 years ago

Running a com.template.NodeDriverKt class from Intellj (2017.3) on Windows 10. It's a clean checkout of corda-v3. It first complains about the command line being too long and suggests switching to shortening command line method: "JAR manifest". After changing it, the program fails with an exception:

[WARN ] 14:22:14,525 [driver-pool-thread-0] (DriverDSLImpl.kt:142) internal.DriverDSLImpl.resolveJar - Unable to locate JAR `.*jolokia-jvm-.*-agent\.jar$` on classpath: Array contains no element matching the predicate. {}

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.util.NoSuchElementException: Array contains no element matching the predicate.
    at net.corda.testing.node.internal.DriverDSLImpl.resolveJar(DriverDSLImpl.kt:1075)
    at net.corda.testing.node.internal.DriverDSLImpl.access$resolveJar(DriverDSLImpl.kt:82)
    at net.corda.testing.node.internal.DriverDSLImpl$jolokiaJarPath$2.invoke(DriverDSLImpl.kt:131)
    at net.corda.testing.node.internal.DriverDSLImpl$jolokiaJarPath$2.invoke(DriverDSLImpl.kt:82)
    at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)
    at net.corda.testing.node.internal.DriverDSLImpl.getJolokiaJarPath(DriverDSLImpl.kt)
    at net.corda.testing.node.internal.DriverDSLImpl.startNodeInternal(DriverDSLImpl.kt:692)
    at net.corda.testing.node.internal.DriverDSLImpl.startRegisteredNode(DriverDSLImpl.kt:243)
    at net.corda.testing.node.internal.DriverDSLImpl.access$startRegisteredNode(DriverDSLImpl.kt:82)
    at net.corda.testing.node.internal.DriverDSLImpl$startNode$2$1.invoke(DriverDSLImpl.kt:211)
    at net.corda.testing.node.internal.DriverDSLImpl$startNode$2$1.invoke(DriverDSLImpl.kt:82)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$flatMap$$inlined$also$lambda$1.invoke(CordaFutureImpl.kt:50)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$flatMap$$inlined$also$lambda$1.invoke(CordaFutureImpl.kt)
    at net.corda.core.concurrent.ConcurrencyUtils.match(ConcurrencyUtils.kt:20)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$thenMatch$1.invoke(CordaFutureImpl.kt:25)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$thenMatch$1.invoke(CordaFutureImpl.kt)
    at net.corda.core.internal.concurrent.CordaFutureImpl$thenImpl$1.accept(CordaFutureImpl.kt:132)
    at net.corda.core.internal.concurrent.CordaFutureImpl$thenImpl$1.accept(CordaFutureImpl.kt:119)
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760)
    at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:736)
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
    at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1962)
    at net.corda.core.internal.concurrent.CordaFutureImpl.set(CordaFutureImpl.kt:125)
    at net.corda.core.internal.concurrent.ValueOrException$DefaultImpls.capture(CordaFutureImpl.kt:106)
    at net.corda.core.internal.concurrent.OpenFuture$DefaultImpls.capture(CordaFutureImpl.kt)
    at net.corda.core.internal.concurrent.CordaFutureImpl.capture(CordaFutureImpl.kt:119)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$map$$inlined$also$lambda$1.invoke(CordaFutureImpl.kt:36)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$map$$inlined$also$lambda$1.invoke(CordaFutureImpl.kt)
    at net.corda.core.concurrent.ConcurrencyUtils.match(ConcurrencyUtils.kt:20)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$thenMatch$1.invoke(CordaFutureImpl.kt:25)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$thenMatch$1.invoke(CordaFutureImpl.kt)
    at net.corda.core.internal.concurrent.CordaFutureImpl$thenImpl$1.accept(CordaFutureImpl.kt:132)
    at net.corda.core.internal.concurrent.CordaFutureImpl$thenImpl$1.accept(CordaFutureImpl.kt:119)
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760)
    at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:736)
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
    at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1962)
    at net.corda.core.internal.concurrent.CordaFutureImpl.set(CordaFutureImpl.kt:125)
    at net.corda.core.internal.concurrent.ValueOrException$DefaultImpls.capture(CordaFutureImpl.kt:106)
    at net.corda.core.internal.concurrent.OpenFuture$DefaultImpls.capture(CordaFutureImpl.kt)
    at net.corda.core.internal.concurrent.CordaFutureImpl.capture(CordaFutureImpl.kt:119)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$map$$inlined$also$lambda$1.invoke(CordaFutureImpl.kt:36)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$map$$inlined$also$lambda$1.invoke(CordaFutureImpl.kt)
    at net.corda.core.concurrent.ConcurrencyUtils.match(ConcurrencyUtils.kt:20)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$thenMatch$1.invoke(CordaFutureImpl.kt:25)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$thenMatch$1.invoke(CordaFutureImpl.kt)
    at net.corda.core.internal.concurrent.CordaFutureImpl$thenImpl$1.accept(CordaFutureImpl.kt:132)
    at net.corda.core.internal.concurrent.CordaFutureImpl$thenImpl$1.accept(CordaFutureImpl.kt:119)
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760)
    at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:736)
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
    at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1962)
    at net.corda.core.internal.concurrent.CordaFutureImpl.set(CordaFutureImpl.kt:125)
    at net.corda.core.internal.concurrent.ValueOrException$DefaultImpls.capture(CordaFutureImpl.kt:106)
    at net.corda.core.internal.concurrent.OpenFuture$DefaultImpls.capture(CordaFutureImpl.kt)
    at net.corda.core.internal.concurrent.CordaFutureImpl.capture(CordaFutureImpl.kt:119)
    at net.corda.core.internal.concurrent.CordaFutureImplKt$fork$$inlined$also$lambda$1.run(CordaFutureImpl.kt:22)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Process finished with exit code 1
andrzejtokarski commented 6 years ago

Turns out the jolokia.jar is required for this configuration to run. I had to download the jar file and add "-javaagent:lib/jolokia-jvm-1.5.0-agent.jar" to run configuration.

AN8991 commented 6 years ago

Ok, here are the steps i followed after this error and got it resolved:

  1. Downloaded jolokia.jar (jolokia-1.6.0 - https://jolokia.org/download.html)
  2. Configured my project in the: Tools> Edit Configurations> VM Options and added the new JAR.
  3. Ran the "Run-Template CorDapp" from the IntelliJ IDE.
  4. First Message Received as : Jolokia: Agent started with URL http://127.0.0.1:8778/jolokia/
  5. On bottom of IntelliJ i could see that compilation was successfull