一些关于config-local.yaml 的问题 (Some questions about daml-for-fabric config.yaml)

关于驱动daml-on-fabric 使用中遇到了以下问题:
配置文件config-local.yaml 中的相关参数根据 注释提示 相应置空之后发现依然无法正确部署到其他fabric网络中错误如下: 我配置了现有网络中的channel(ntchannel)
image

3 Likes

Hi @uid10086 , welcome to the forum. I don’t speak mandarin so I used Google Translate and got this (posting for everyone else’s benefit):

The following problems have been encountered in the use of the driver daml-on-fabric: The relevant parameters in the configuration file config-local.yaml are prompted according to the comments. After the corresponding blanking, it is still unable to be deployed to other fabric networks. The error is as follows: I configured the channel (ntchannel) in the existing network

Could you post the versions of all the dependencies listed on the daml-for-fabric readme page that you have installed, please? And how exactly are you running this? Are you following some guide or example?

1 Like

sbt version 1.5.3
daml sdk 1.11.0
centos 7
其他的软件环境和官方文档一致

1 Like

I suspect you are running into this issue: Bug ID: JDK-8133521 (fs) Paths.get(null); throws NullPointerException

That would happen if the field config.channel.chaincode.metapath here is null.

Looking at your config, that is exactly the case… Could you try just setting a random path for the meatapath?

1 Like

Actually, I think it should be

    gopath: ./chaincode
    metapath: ./chaincode/src/github.com/digital-asset/daml-on-fabric/META-INF
    entryPath: github.com/digital-asset/daml-on-fabric

in your config. You also seem to have lost the ./ in front of chaincode in gopath.

1 Like

因为我需要连接到其他网络,根据文档提示,我需要置空这个选项

1 Like

这是默认的参考文件config-local.yaml 中的配置,请注意观察,同目录下并没使用./

1 Like

I see. The Java Bug I referenced above seems to be specific to Oracle Java 8. Is that what you are using? If so, a different Java version or distro probably fixes this?

Alternatively, you can bravely apply a local patch to the file I linked above. Change

Files.exists(Paths.get(config.channel.chaincode.metapath))

to

config.channel.chaincode.metapath != null && Files.exists(Paths.get(config.channel.chaincode.metapath))
1 Like

但是我想连接的是自己的fabric网络,并且已经有了channel(ntchannel),那么我需要怎么配置呢,根据模版文件config-local.yaml的提示,我需要把这些选项(this attribute should be empty.),我应该如何配置

1 Like

I think your config was fine. If you are using Oracle Java 8, you are running into a bug that occurs exactly if you run daml-for-fabric with empty metapath on that Java version.

The best way to verify is to either switch java version if you have another one available, or to try out the patch suggested above.

The daml-for-fabric experts around here are largely US-based so if neither of those work, we may have to wait for them to get up.

2 Likes

好的,我明白了,我尝试更换一下java sdk版本,谢谢

2 Likes

我已经更换到了java sdk 11版本,还是会存在空指针问题,根据模版提示,这些都是可以置空的,我又困扰在了这里



1 Like

So, i had another quick look and actually ran a test this time since you are no longer running into a Java bug. “empty” in the readme appears to mean “empty string”, not null. That needs to be clarified.

I can connect to an existing channel with this config:

channel:
  name: mainchannel
  channelTxFile: ''
  endorsementPolicy: ''
  chaincode:
    name: daml_on_fabric
    type: golang
    version: 1.0
    gopath: ''
    metapath: ''
    entryPath: github.com/digital-asset/daml-on-fabric
    queryWaitTime: 30000
    invokeWaitTime: 60000
3 Likes

出现了新的问题,因为没有配置chaincode 的路径
image

1 Like

Hi,
如我們在會議中所建議,請試試使用新的channel,而我會測試能否使用現有channel.
As mentioned in our call, let’s try to use a new channel for daml-on-fabric, and I will test the setup using an existing channel.

kc

1 Like

So just to clarify: ntchannel is an existing channel, but it doesn’t have daml running on it yet? As far as I understand, there are really three operations:

  1. Create a Fabric Channel
  2. Deploy the Chain Code for daml for fabric
  3. Run Daml over a Fabric channel with that chain code

The channelTxFile and endorsementPolicy fields are inputs for creating a new channel, ie for 1.
The gopath, metapath, and entryPath fields are for deploying the chaincode (ie 2). Both of those are done as part of the “provision” role in daml-on-fabric.

Now I’m actually not sure how to do 2 without doing 1, but I think your best bet would be to leave channelTxFile and endorsementPolicy empty and fill in gopath, metapath, and entryPath.
Then for every second daml-for-fabric instance you connect, you either remove the provision role, or also leave the chaincode fields empty.

1 Like

Hi @bernhard yes, we understand the three steps. What we wish to check is that whether item 1 can be an existing channel where item 2 is not running yet. So far I have tested 1-2-3 together works fine (where 1 is a new channel).

1 Like

As I said, I think this is probably the way:

1 Like

Yes, we will test this and let you know the result. Thanks again and have a nice weekend.

1 Like

感谢你们的帮助,周末愉快,谢谢!我会继续测试

3 Likes