Kotlin net.corda.nodeapi.internal.persistence.CouldNotCreateDataSourceException:无法创建数据源

Kotlin net.corda.nodeapi.internal.persistence.CouldNotCreateDataSourceException:无法创建数据源,kotlin,liquibase,corda,discord,Kotlin,Liquibase,Corda,Discord,我正试图用这个例子开发一个CorDapp。我在我的项目中添加了两个模块,一个用于合同,另一个用于流。我已经为我的合同添加了测试用例,它运行良好,但流的测试用例在安装阶段失败。这是我的测试类的代码 @TestInstance(TestInstance.Lifecycle.PER_CLASS) class SharedInformationFlowTests { private lateinit var network: MockNetwork private lateinit var

我正试图用这个例子开发一个CorDapp。我在我的项目中添加了两个模块,一个用于合同,另一个用于流。我已经为我的合同添加了测试用例,它运行良好,但流的测试用例在安装阶段失败。这是我的测试类的代码

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 class SharedInformationFlowTests {
   private lateinit var network: MockNetwork
   private lateinit var a: StartedMockNode
   private val proposal = LedgerUpdateProposal.testProposal()

@BeforeAll
fun setup() {
    val params = MockNetworkParameters(cordappsForAllNodes = listOf(
            TestCordapp.findCordapp("com.something.contract")
    ))

    network = MockNetwork(params) //fails here
    a = network.createPartyNode()
    network.runNetwork()
}

@AfterAll
fun tearDown() {
    network.stopNodes()
}
以下是我收到的错误消息:

[WARN] 13:42:52,620 [main] spi.SqlExceptionHelper. - SQL Error: 0, SQLState: null {changeSet=migration/vault-schema.changelog-v9.xml::update-vault-states::R3.Corda, databaseChangeLog=master.changelog.json}
[ERROR] 13:42:52,620 [main] spi.SqlExceptionHelper. - Connection is closed {changeSet=migration/vault-schema.changelog-v9.xml::update-vault-states::R3.Corda, databaseChangeLog=master.changelog.json}


net.corda.nodeapi.internal.persistence.CouldNotCreateDataSourceException: Could not create the 
DataSource: Migration failed for change set migration/vault-schema.changelog-v9.xml::update-vault-states::R3.Corda:
 Reason: net.corda.nodeapi.internal.persistence.HibernateConfigException: Could not create Hibernate configuration: Unable to open JDBC Connection for DDL execution
我想这酒有问题。我尝试将changelog文件添加到我的
resources/migration
目录中,但似乎没有任何效果。请帮忙

更新添加了架构

/**
 * The family of com.sentinel.schemas for SharingInformationState.
 */
object SharingInformationSchema

/**
 * An SharingInformationState schema.
 */
object SharingInformationSchemaV1 : MappedSchema(
    schemaFamily = SharingInformationSchema.javaClass,
    version = 1,
    mappedTypes = listOf(PersistentSharingInformation::class.java)) {
override val migrationResource: String? = "sharing-information-schema-v1.changelog-master.xml"

@Entity
@Table(name = "persistent_sharing_information")
class PersistentSharingInformation(
        @Column(name = "owner_id")
        var dataOwnerId: Long,

        @Column(name = "buyer_id")
        var dataBuyerId: Long,

        @Column(name = "start_date")
        val startDate: String,

        @Column(name = "end_date")
        val endDate: String,

        @Column(name = "shared_fields")
        val sharedFieldsIds: String,

        @Column(name = "agreement_status")
        val agreementStatus: String,

        @Column(name = "contract_type")
        val contractType: String,

        @Column(name = "linear_id")
        var linearId: UUID
) : PersistentState() {

    // Default constructor required by hibernate.
    constructor() : this(0L,  0L,
            "", "", "[]", "", "", UUID.randomUUID())
}
}

@BelongsToContract(com.package.contract.SharingInformationContract::class)
类别共享信息状态(val ourParty:Party,
val提案:账本更新提案,
重写val linearId:UniqueIdentifier=UniqueIdentifier()):LinearState,QueryableState{
覆盖val参与者:列表=listOf(ourParty)
重写fun generateMappedObject(架构:MappedSchema):PersistentState{
返回时(架构){
SharingInformation Schemav1->SharingInformation Schemav1.PersistentSharingInformation(
proposition.ownerId,
建议1.buyerId,
提案开始日期,
提案.截止日期:,
proposal.sharedFieldsIds.toString(),
提案.协议状态.名称,
proposal.contractType.name,
linearId.id
)
else->抛出IllegalArgumentException(“无法识别的架构$schema”)
}
}
重写fun supportedSchemas():Iterable=listOf(共享信息Schemav1)
}
@可互换
枚举类协议状态{已批准,已拒绝}
@可互换
枚举类ContractType{公司、消费者、营销、绑定}

从注释判断,您使用的是我更喜欢的JUnit 5,并且以前使用过,没有任何问题;但我知道R3工程师总是使用JUnit4,这也是Corda所支持的。值得尝试一下JUnit4,看看错误是否消失。另外,
LedgerUpdateProposal.testProposal()
?我以前从未在任何测试中见过这一行;在更改JUnit版本之前,请尝试对其进行注释。谢谢您的注释。LedgerUpdateProposition是我的国家级课程。尝试切换到JUnit 4-无效。您可以与我共享您的存储库吗?或者在这里放置一个链接,或者将其发送到Corda的Slack(cordaledger.Slack.com)。嗯,我觉得一切都很好:-/也许在Corda的存储库中提出一个问题并引用这个问题?Corda的Slack频道也是一个不错的地方,你可以在那里发布这个问题的链接。谢谢你的建议。让我们看看它能给我们带来什么。
 @BelongsToContract(com.package.contract.SharingInformationContract::class)
 class SharingInformationState(val ourParty: Party,
                          val proposal: LedgerUpdateProposal,
                          override val linearId: UniqueIdentifier = UniqueIdentifier()) : LinearState, QueryableState {

override val participants: List<AbstractParty> = listOf(ourParty)

override fun generateMappedObject(schema: MappedSchema): PersistentState {
    return when (schema) {
        SharingInformationSchemaV1 -> SharingInformationSchemaV1.PersistentSharingInformation(
                proposal.ownerId,
                proposal.buyerId,
                proposal.startDate,
                proposal.endDate,
                proposal.sharedFieldsIds.toString(),
                proposal.agreementStatus.name,
                proposal.contractType.name,
                linearId.id
        )
        else -> throw IllegalArgumentException("Unrecognised schema $schema")
    }
}

override fun supportedSchemas(): Iterable<MappedSchema> = listOf(SharingInformationSchemaV1)

}

  @CordaSerializable
  enum class AgreementStatus { APPROVED, REJECTED }
  @CordaSerializable
  enum class ContractType { CORPORATE, CONSUMER, MARKETING, BINDING }