Corda service does not exist when running flow on local network created by driver (NodeDriver.kt)

白昼怎懂夜的黑 提交于 2019-12-13 04:11:14

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!