corda / corda

Corda is an open source blockchain project, designed for business from the start. Only Corda allows you to build interoperable blockchain networks that transact in strict privacy. Corda's smart contract technology allows businesses to transact directly, with value.
https://www.corda.net
Apache License 2.0
3.99k stars 1.08k forks source link

Corda token-template java.lang.NoClassDefFoundError. Crash shell exits. #5835

Closed karthik137 closed 4 years ago

karthik137 commented 4 years ago

Description

Got Exception in thread "main" java.lang.NoClassDefFoundError: com/r3/corda/lib/tokens/selection/api/Selector while executing runnodes.jar

Steps to reproduce the issue

.\gradlew clean deployNodes

LOG -->

w: C:\Users\srinupadma\karthikkun37\corda\debug\cordapp-template-kotlin\workflows\src\main\kotlin\com\template\flows\ExampleFlowWithEvolvableToken.kt: (32, 13): Variable 'notary' is never used

> Task :jar 
Cordapp metadata not defined for this gradle build file. See https://docs.corda.net/head/cordapp-build-systems.html#separation-of-cordapp-contracts-flows-and-services

> Task :deployNodes 
Running Cordform task
Deleting C:\Users\srinupadma\karthikkun37\corda\debug\cordapp-template-kotlin\build\nodes
Bootstrapping local test network in C:\Users\srinupadma\karthikkun37\corda\debug\cordapp-template-kotlin\build\nodes
Generating node directory for Notary
Generating node directory for PartyA
Generating node directory for PartyB
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Waiting for all nodes to generate their node-info files...

... still waiting. If this is taking longer than usual, check the node logs.

> Task :deployNodes 
Distributing all node-info files to all nodes
Loading existing network parameters... none found
Gathering notary identities
Generating contract implementations whitelist
New NetworkParameters {
      minimumPlatformVersion=5
      notaries=[NotaryInfo(identity=O=Notary, L=London, C=GB, validating=false)]
      maxMessageSize=10485760
      maxTransactionSize=524288000
      whitelistedContractImplementations {

      }
      eventHorizon=PT720H
      packageOwnership {

      }
      modifiedTime=2020-01-05T11:41:57.844Z
      epoch=1
  }
Bootstrapping complete!

BUILD SUCCESSFUL in 52s
19 actionable tasks: 18 executed, 1 up-to-date
java -jar runnodes.jar

LOG -->

   ______               __
  / ____/     _________/ /___ _
 / /     __  / ___/ __  / __ `/         My wife just found out I replaced our bed
/ /___  /_/ / /  / /_/ / /_/ /          with a trampoline; she hit the roof.
\____/     /_/   \__,_/\__,_/

--- Corda Open Source 4.3 (d679784) -------------------------------------------------------------

Logs can be found in                    : C:\Users\srinupadma\karthikkun37\corda\debug\cordapp-template-kotlin\build\nodes\PartyA\logs
[quasar] WARNING: Method not found in class - assuming suspendable: com/r3/corda/lib/tokens/selection/api/Selector#generateMove$default(Lcom/r3/corda/lib/tokens/selection/api/Selector;Ljava/util/List;Lnet/corda/core/identity/AbstractParty;Lcom/r3/corda/lib/tokens/selection/TokenQueryBy;Ljava/util/UUID;ILjava/lang/Object;)Lkotlin/Pair; (at TestFlows.kt:com/r3/corda/lib/tokens/workflows/internal/testflows/DvPFlowHandler#call)
[quasar] WARNING: Method not found in class - assuming suspendable: com/r3/corda/lib/tokens/testing/states/House#getValuation()Lnet/corda/core/contracts/Amount; (at TestFlows.kt:com/r3/corda/lib/tokens/workflows/internal/testflows/DvPFlow#call)
[quasar] WARNING: Method not found in class - assuming suspendable: com/r3/corda/lib/tokens/selection/api/Selector#selectTokens$default(Lcom/r3/corda/lib/tokens/selection/api/Selector;Lnet/corda/core/contracts/Amount;Lcom/r3/corda/lib/tokens/selection/TokenQueryBy;Ljava/util/UUID;ILjava/lang/Object;)Ljava/util/List; (at TestFlows.kt:com/r3/corda/lib/tokens/workflows/internal/testflows/SelectAndLockFlow#call)
[quasar] WARNING: Method not found in class - assuming suspendable: com/r3/corda/lib/tokens/selection/database/selector/DatabaseTokenSelection#generateMove(Ljava/util/List;Lnet/corda/core/identity/AbstractParty;Lcom/r3/corda/lib/tokens/selection/TokenQueryBy;Ljava/util/UUID;)Lkotlin/Pair; (at ConfidentialMoveFungibleTokensFlow.kt:com/r3/corda/lib/tokens/workflows/flows/move/ConfidentialMoveFungibleTokensFlow#call)
! ATTENTION: This node is running in development mode!  This is not safe for production deployment.
Exception in thread "main" java.lang.NoClassDefFoundError: com/r3/corda/lib/tokens/selection/api/Selector
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
        at java.lang.Class.getDeclaredConstructors(Unknown Source)
        at net.corda.node.internal.NodeFlowManager.registerInitiatedFlow(FlowManager.kt:77)
        at net.corda.node.internal.AbstractNode$registerCordappFlows$$inlined$forEach$lambda$1.accept(AbstractNode.kt:727)
        at net.corda.node.internal.AbstractNode$registerCordappFlows$$inlined$forEach$lambda$1.accept(AbstractNode.kt:122)
        at java.util.LinkedHashMap.forEach(Unknown Source)
        at net.corda.node.internal.AbstractNode.registerCordappFlows(AbstractNode.kt:724)
        at net.corda.node.internal.AbstractNode.start(AbstractNode.kt:344)
        at net.corda.node.internal.Node.start(Node.kt:447)
        at net.corda.node.internal.NodeStartup.startNode(NodeStartup.kt:210)
        at net.corda.node.internal.NodeStartupCli$runProgram$2.run(NodeStartup.kt:131)
        at net.corda.node.internal.NodeStartup$initialiseAndRun$5.invoke(NodeStartup.kt:187)
        at net.corda.node.internal.NodeStartup$initialiseAndRun$5.invoke(NodeStartup.kt:138)
        at net.corda.node.internal.NodeStartupLogging$DefaultImpls.attempt(NodeStartup.kt:529)
        at net.corda.node.internal.NodeStartup.attempt(NodeStartup.kt:138)
        at net.corda.node.internal.NodeStartup.initialiseAndRun(NodeStartup.kt:186)
        at net.corda.node.internal.NodeStartupCli.runProgram(NodeStartup.kt:129)
        at net.corda.cliutils.CordaCliWrapper.call(CordaCliWrapper.kt:190)
        at net.corda.node.internal.NodeStartupCli.call(NodeStartup.kt:84)
        at net.corda.node.internal.NodeStartupCli.call(NodeStartup.kt:65)
        at picocli.CommandLine.execute(CommandLine.java:1173)
        at picocli.CommandLine.access$800(CommandLine.java:141)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:1367)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:1335)
        at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1243)
        at picocli.CommandLine.parseWithHandlers(CommandLine.java:1526)
        at net.corda.cliutils.CordaCliWrapperKt.start(CordaCliWrapper.kt:73)
        at net.corda.node.Corda.main(Corda.kt:13)
Caused by: java.lang.ClassNotFoundException: com.r3.corda.lib.tokens.selection.api.Selector
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 29 more
[ERROR] 17:06:11+0530 [main] internal.GeneralExceptionHandler. - Exception in thread "main" [errorCode=1gnp94c, moreInformationAt=https://errors.corda.net/OS/4.3/1gnp94c]

Workaround

Change token_release_version in build.gradle file

tokens_release_version = '1.1-RC05' --> tokens_release_version = '1.0'

Run

$ .\gradlew clean deployNodes. 
$ cd ./build/nodes
$ java -jar runnodes.jar

Now crash shell will launch successfully.

System information

OS : Windows 10 64 bit Java : version 8 Corda version : 4.3 Corda token version : 1.1-RC05

roger-that-dev commented 4 years ago

You need to add the tokens-selection dependency to your project.

https://ci-artifactory.corda.r3cev.com/artifactory/corda-lib-dev/com/r3/corda/lib/tokens/tokens-selection/

roger-that-dev commented 4 years ago

See docs here: https://github.com/corda/token-sdk#adding-token-sdk-dependencies-to-an-existing-cordapp

adrian1313 commented 4 years ago

It doesn't work @roger3cev