为什么我得到硬编码的价值?

时间:2018-04-16 12:08:31

标签: corda

以下是build.gradle中代码的一部分。

...
2018-04-16 20:37:21,775 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
2018-04-16 20:37:21,780 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
[INFO ] 20:37:29,586 [driver-pool-thread-0] (ConfigUtilities.kt:38) config.ConfigHelper.loadConfig - Config:
{
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 20
    "activeMQServer" : {
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 21
        "bridge" : {
            # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 24
            "maxRetryIntervalMin" : 3,
            # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 22
            "retryIntervalMs" : 5000,
            # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 23
            "retryIntervalMultiplier" : 1.5
        }
    },
    # hardcoded value
    "baseDirectory" : "C:\\work\\corda\\cordapp-example\\build\\20180416-113719.630\\NotaryService",
    # merge of reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 6,reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda/3.1-corda/c56c8389dd277cf2a9751f6c9510d1a9f85da47e/corda-3.1-corda.jar!/reference.conf: 6,reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-webserver/3.1-corda/f927e48482062fff3761bf293ce5ab2e3191e542/corda-webserver-3.1-corda.jar!/reference.conf: 6
    "dataSourceProperties" : {
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 10
        "dataSource.password" : "",
        # merge of reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 8,hardcoded value,reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 8,reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 17
        "dataSource.url" : "jdbc:h2:file:C:\\work\\corda\\cordapp-example\\build\\20180416-113719.630\\NotaryService/persistence;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;WRITE_DELAY=100;AUTO_SERVER_PORT=0",
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 9
        "dataSource.user" : "sa",
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 7
        "dataSourceClassName" : "org.h2.jdbcx.JdbcDataSource"
    },
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 12
    "database" : {
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 14
        "exportHibernateJMXStatistics" : "false",
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 13
        "transactionIsolationLevel" : "REPEATABLE_READ"
    },
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 16
    "devMode" : true,
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 2
    "emailAddress" : "admin@company.com",
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 3
    "exportJMXto" : "http",
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 17
    "h2port" : 0,
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 4
    "keyStorePassword" : "cordacadevpass",
    # hardcoded value
    "myLegalName" : "O=Notary Service, L=Zurich, C=CH",
    # hardcoded value
    "notary" : {
        # hardcoded value
        "custom" : false,
        # hardcoded value
        "validating" : true
    },
    # hardcoded value
    "p2pAddress" : "localhost:10002",
    # merge of hardcoded value,reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 27
    "rpcSettings" : {
        # hardcoded value
        "address" : "localhost:10003",
        # hardcoded value
        "adminAddress" : "localhost:10004",
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 29
        "standAloneBroker" : false,
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 28
        "useSsl" : false
    },
    # hardcoded value
    "rpcUsers" : [
        # hardcoded value
        {
            # hardcoded value
            "password" : "default",
            # hardcoded value
            "permissions" : [
                # hardcoded value
                "ALL"
            ],
            # hardcoded value
            "username" : "default"
        }
    ],
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 5
    "trustStorePassword" : "trustpass",
    # hardcoded value
    "useTestClock" : false,
    # hardcoded value
    "verifierType" : "InMemory",
    # hardcoded value
    "webAddress" : "localhost:10005"
}
 {}
[INFO ] 20:37:29,673 [driver-pool-thread-0] (NodeInfoFilesCopier.kt:63) network.NodeInfoFilesCopier.addConfig - Now watching: C:\work\corda\cordapp-example\build\20180416-113719.630\NotaryService {}
[INFO ] 20:37:29,677 [driver-pool-thread-0] (DriverDSLImpl.kt:814) internal.DriverDSLImpl.startOutOfProcessNode - Starting out-of-process Node Notary Service, debug port is 5005, jolokia monitoring port is not enabled {}
[INFO ] 20:37:29,829 [driver-pool-thread-0] (ConfigUtilities.kt:38) config.ConfigHelper.loadConfig - Config:
{
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 20
    "activeMQServer" : {
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 21
        "bridge" : {
            # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 24
            "maxRetryIntervalMin" : 3,
            # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 22
            "retryIntervalMs" : 5000,
            # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 23
            "retryIntervalMultiplier" : 1.5
        }
    },
    # hardcoded value
    "baseDirectory" : "C:\\work\\corda\\cordapp-example\\build\\20180416-113719.630\\PartyB",
    # merge of reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 6,reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda/3.1-corda/c56c8389dd277cf2a9751f6c9510d1a9f85da47e/corda-3.1-corda.jar!/reference.conf: 6,reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-webserver/3.1-corda/f927e48482062fff3761bf293ce5ab2e3191e542/corda-webserver-3.1-corda.jar!/reference.conf: 6
    "dataSourceProperties" : {
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 10
        "dataSource.password" : "",
        # merge of reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 8,hardcoded value,reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 8,reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 17
        "dataSource.url" : "jdbc:h2:file:C:\\work\\corda\\cordapp-example\\build\\20180416-113719.630\\PartyB/persistence;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;WRITE_DELAY=100;AUTO_SERVER_PORT=0",
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 9
        "dataSource.user" : "sa",
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 7
        "dataSourceClassName" : "org.h2.jdbcx.JdbcDataSource"
    },
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 12
    "database" : {
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 14
        "exportHibernateJMXStatistics" : "false",
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 13
        "transactionIsolationLevel" : "REPEATABLE_READ"
    },
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 16
    "devMode" : true,
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 2
    "emailAddress" : "admin@company.com",
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 3
    "exportJMXto" : "http",
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 17
    "h2port" : 0,
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 4
    "keyStorePassword" : "cordacadevpass",
    # hardcoded value
    "myLegalName" : "O=PartyB, L=New York, C=US",
    # hardcoded value
    "p2pAddress" : "localhost:10001",
    # merge of hardcoded value,reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 27
    "rpcSettings" : {
        # hardcoded value
        "address" : "localhost:10006",
        # hardcoded value
        "adminAddress" : "localhost:10007",
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 29
        "standAloneBroker" : false,
        # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 28
        "useSsl" : false
    },
    # hardcoded value
    "rpcUsers" : [
        # hardcoded value
        {
            # hardcoded value
            "password" : "test",
            # hardcoded value
            "permissions" : [
                # hardcoded value
                "ALL",
                # hardcoded value
                "InvokeRpc.nodeInfo",
                # hardcoded value
                "InvokeRpc.networkMapFeed",
                # hardcoded value
                "InvokeRpc.networkMapSnapshot",
                # hardcoded value
                "InvokeRpc.notaryIdentities",
                # hardcoded value
                "InvokeRpc.stateMachinesFeed",
                # hardcoded value
                "InvokeRpc.stateMachineRecordedTransactionMappingFeed",
                # hardcoded value
                "InvokeRpc.nodeInfoFromParty",
                # hardcoded value
                "InvokeRpc.internalVerifiedTransactionsFeed",
                # hardcoded value
                "InvokeRpc.vaultQueryBy",
                # hardcoded value
                "InvokeRpc.vaultTrackBy",
                # hardcoded value
                "InvokeRpc.registeredFlows"
            ],
            # hardcoded value
            "username" : "user1"
        }
    ],
    # reference.conf @ jar:file:/C:/Users/XXXXX/.gradle/caches/modules-2/files-2.1/net.corda/corda-node/3.1-corda/d885cb735f9d9e70dc630587cc5df98c9740f8df/corda-node-3.1-corda.jar!/reference.conf: 5
    "trustStorePassword" : "trustpass",
    # hardcoded value
    "useTestClock" : false,
    # hardcoded value
    "verifierType" : "InMemory",
    # hardcoded value
    "webAddress" : "localhost:10008"
}
 {}
...

当我从IntelliJ构建并运行节点时,我可以看到日志。

(ExampleApi.kt:85) api.ExampleApi.createIOU - Failed requirement. {}
java.lang.IllegalArgumentException: Failed requirement.

我不知道硬编码值是如何创建的。我无法连接到我设置的webPort(10007和10010),但可以访问硬编码端口(10008和10011)。两方的价值是正确的,但公证人的位置是苏黎世。它原本应该是伦敦。

我尝试创建IOU但失败了。这是错误消息:

  //Read from the database

        myRef.addValueEventListener(new ValueEventListener() 

                 {

            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                // This method is called once with the initial value and again
                // whenever data at this location is updated.
                String value = dataSnapshot.getValue(String.class);
                Log.d(TAG, "Value is: " + value);
            }

            @Override
            public void onCancelled(DatabaseError error) {
                // Failed to read value
                Log.w(TAG, "Failed to read value.", error.toException());
            }
        });

有谁知道如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

deployNodes任务的配置仅在从命令行运行节点时使用(使用gradlew deployNodes)。

通过IntelliJ运行节点时,使用节点驱动程序(例如https://github.com/corda/cordapp-example/blob/release-V3/java-source/src/test/java/com/example/NodeDriver.java)。

使用DriverParameters对象配置节点驱动程序。 DriverParameters对象具有withPortAllocation方法,允许您控制节点端口的分配方式。