问题
I am getting following exception when accessing a service in flow of a cordapp
java.lang.IllegalArgumentException: Corda service com.example.services.MyService does not exist
i am using cordaV2 and have tried to edit NodeDriver.kt with
driver(isDebug = true, extraCordappPackagesToScan = listOf("com.example.services"))
but it doesn't help.
How can i update cordApp code that it runs locally on network created from NodeDriver.kt and it doesn't throw this exception!
回答1:
I rechecked my code and realized i wasn't using ServiceHub parameter in my service class. After adding that it was fixed.
class MyService(val services: ServiceHub) : SingletonSerializeAsToken()
来源:https://stackoverflow.com/questions/49704930/corda-service-does-not-exist-when-running-flow-on-local-network-created-by-drive