在驱动程序(NodeDriver.kt)创建的本地网络上运行流时,Corda服务不存在 [英] Corda service does not exist when running flow on local network created by driver (NodeDriver.kt)
问题描述
在cordapp流程中访问服务时出现以下异常
I am getting following exception when accessing a service in flow of a cordapp
java.lang.IllegalArgumentException:Corda服务com.example.services.MyService不存在
java.lang.IllegalArgumentException: Corda service com.example.services.MyService does not exist
我正在使用cordaV2,并尝试使用
i am using cordaV2 and have tried to edit NodeDriver.kt with
driver(isDebug = true,extraCordappPackagesToScan =listOf("com.example.services"))
driver(isDebug = true, extraCordappPackagesToScan = listOf("com.example.services"))
但这没有帮助.
如何更新在NodeDriver.kt创建的网络上本地运行的cordApp代码,并且不会引发此异常!
How can i update cordApp code that it runs locally on network created from NodeDriver.kt and it doesn't throw this exception!
推荐答案
我重新检查了代码,发现我没有在服务类中使用ServiceHub参数.添加后,它是固定的.
I rechecked my code and realized i wasn't using ServiceHub parameter in my service class. After adding that it was fixed.
MyService类( val服务:ServiceHub ):SingletonSerializeAsToken()
class MyService(val services: ServiceHub) : SingletonSerializeAsToken()
这篇关于在驱动程序(NodeDriver.kt)创建的本地网络上运行流时,Corda服务不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!