注意Corda使用hibernate 5.2.6和JPA 2.1。我还试图在模式中保持数据类型,即java.time.Year
,并且在提交状态时,hibernate在FinalityFlow
期间抛出错误。
说当前版本的Corda 3.0不支持这些数据类型是否正确? 即
@Entity
@Table(name = "custom_states")
class customEntity(
@Column(name = "issued_date")
var issuedDate: LocalDate? = null,
@Column(name = "issued_year")
var issuedYear: Year? = null),
@Column(name = "validity")
var validity: Duration? = null)
[已编辑] 这是错误日志。
[INFO ] 2018-04-09T10:43:49,616Z [Node thread-1] persistence.HibernateConfiguration.makeSessionFactoryForSchemas - Creating session factory for schemas: [ObligationSchemaV1(name=net.corda.examples.obligation.ObligationSchema, version=1)] {}
[INFO ] 2018-04-09T10:43:49,623Z [Node thread-1] internal.ConnectionProviderInitiator.initiateService - HHH000130: Instantiating explicit connection provider: net.corda.nodeapi.internal.persistence.HibernateConfiguration$NodeDatabaseConnectionProvider {}
[INFO ] 2018-04-09T10:43:49,624Z [Node thread-1] dialect.Dialect.<init> - HHH000400: Using dialect: org.hibernate.dialect.H2Dialect {}
[INFO ] 2018-04-09T10:43:49,631Z [Node thread-1] type.BasicTypeRegistry.register - HHH000270: Type registration [materialized_blob] overrides previous : org.hibernate.type.MaterializedBlobType@4cf230bf {}
[INFO ] 2018-04-09T10:43:49,648Z [Node thread-1] connections.access.getIsolatedConnection - HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@5816c8a9] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode. {}
[INFO ] 2018-04-09T10:43:49,667Z [Node thread-1] persistence.HibernateConfiguration.makeSessionFactoryForSchemas - Created session factory for schemas: [ObligationSchemaV1(name=net.corda.examples.obligation.ObligationSchema, version=1)] {}
[INFO ] 2018-04-09T10:43:49,747Z [Node thread-1] io.serialization.log - ObjectInputFilter REJECTED: class java.time.Ser, array length: -1, nRefs: 1, depth: 1, bytes: 32, ex: n/a {}
[WARN ] 2018-04-09T10:43:49,757Z [Node thread-1] flow.[f4ffd102-b49d-4944-a064-d8d1f9ae4049].run - Terminated by unexpected exception {}
rx.exceptions.OnErrorNotImplementedException: org.hibernate.type.SerializationException: could not deserialize
at rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:386) ~[rxjava-1.2.4.jar:1.2.4]
at rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:383) ~[rxjava-1.2.4.jar:1.2.4]
at rx.internal.util.ActionSubscriber.onError(ActionSubscriber.java:44) ~[rxjava-1.2.4.jar:1.2.4]
at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:153) ~[rxjava-1.2.4.jar:1.2.4]
at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:115) ~[rxjava-1.2.4.jar:1.2.4]
at rx.exceptions.Exceptions.throwOrReport(Exceptions.java:216) ~[rxjava-1.2.4.jar:1.2.4]
at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:139) ~[rxjava-1.2.4.jar:1.2.4]
at rx.subjects.PublishSubject$PublishSubjectProducer.onNext(PublishSubject.java:304) ~[rxjava-1.2.4.jar:1.2.4]
at rx.subjects.PublishSubject$PublishSubjectState.onNext(PublishSubject.java:219) ~[rxjava-1.2.4.jar:1.2.4]
at rx.subjects.PublishSubject.onNext(PublishSubject.java:72) ~[rxjava-1.2.4.jar:1.2.4]
at rx.internal.util.ObserverSubscriber.onNext(ObserverSubscriber.java:34) ~[rxjava-1.2.4.jar:1.2.4]
at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:134) ~[rxjava-1.2.4.jar:1.2.4]
at rx.subjects.PublishSubject$PublishSubjectProducer.onNext(PublishSubject.java:304) ~[rxjava-1.2.4.jar:1.2.4]
at rx.subjects.PublishSubject$PublishSubjectState.onNext(PublishSubject.java:219) ~[rxjava-1.2.4.jar:1.2.4]
at rx.subjects.PublishSubject.onNext(PublishSubject.java:72) ~[rxjava-1.2.4.jar:1.2.4]
at net.corda.node.services.vault.NodeVaultService.processAndNotify(NodeVaultService.kt:203) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.vault.NodeVaultService.access$processAndNotify(NodeVaultService.kt:47) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.vault.NodeVaultService$notifyAll$1.invoke(NodeVaultService.kt:116) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.vault.NodeVaultService.notifyAll(NodeVaultService.kt:126) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.api.ServiceHubInternal$DefaultImpls.recordTransactions(ServiceHubInternal.kt:118) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.internal.AbstractNode$ServiceHubInternalImpl$recordTransactions$1.invoke(AbstractNode.kt:811) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.internal.AbstractNode$ServiceHubInternalImpl$recordTransactions$1.invoke(AbstractNode.kt:772) ~[corda-node-corda-3.0.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:132) ~[corda-node-api-corda-3.0.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:120) ~[corda-node-api-corda-3.0.jar:?]
at net.corda.nodeapi.internal.persistence.CordaPersistence.transaction(CordaPersistence.kt:127) ~[corda-node-api-corda-3.0.jar:?]
at net.corda.node.internal.AbstractNode$ServiceHubInternalImpl.recordTransactions(AbstractNode.kt:810) ~[corda-node-corda-3.0.jar:?]
at net.corda.core.node.ServiceHub$DefaultImpls.recordTransactions(ServiceHub.kt:201) ~[corda-core-corda-3.0.jar:?]
at net.corda.node.services.api.ServiceHubInternal$DefaultImpls.recordTransactions(ServiceHubInternal.kt) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.internal.AbstractNode$ServiceHubInternalImpl.recordTransactions(AbstractNode.kt:772) ~[corda-node-corda-3.0.jar:?]
at net.corda.core.node.ServiceHub$DefaultImpls.recordTransactions(ServiceHub.kt:193) ~[corda-core-corda-3.0.jar:?]
at net.corda.node.services.api.ServiceHubInternal$DefaultImpls.recordTransactions(ServiceHubInternal.kt) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.internal.AbstractNode$ServiceHubInternalImpl.recordTransactions(AbstractNode.kt:772) ~[corda-node-corda-3.0.jar:?]
at net.corda.core.flows.FinalityFlow.notariseAndRecord(FinalityFlow.kt:78) ~[corda-core-corda-3.0.jar:?]
at net.corda.core.flows.FinalityFlow.call(FinalityFlow.kt:56) ~[corda-core-corda-3.0.jar:?]
at net.corda.core.flows.FinalityFlow.call(FinalityFlow.kt:28) ~[corda-core-corda-3.0.jar:?]
at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:290) ~[corda-core-corda-3.0.jar:?]
at net.corda.examples.obligation.flows.IssueObligation$Initiator.call(IssueObligation.kt:71) ~[kotlin-source-0.1.jar:?]
at net.corda.examples.obligation.flows.IssueObligation$Initiator.call(IssueObligation.kt:21) ~[kotlin-source-0.1.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:96) [corda-node-corda-3.0.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:44) [corda-node-corda-3.0.jar:?]
at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) [quasar-core-0.7.9-jdk8.jar:0.7.9]
at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) [quasar-core-0.7.9-jdk8.jar:0.7.9]
at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) [quasar-core-0.7.9-jdk8.jar:0.7.9]
at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) [quasar-core-0.7.9-jdk8.jar:0.7.9]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_151]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_151]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_151]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_151]
at net.corda.node.utilities.AffinityExecutor$ServiceAffinityExecutor$1$thread$1.run(AffinityExecutor.kt:62) [corda-node-corda-3.0.jar:?]
Caused by: javax.persistence.PersistenceException: org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:147) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:155) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:162) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:780) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:758) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at net.corda.node.services.schema.HibernateObserver.persistStatesWithSchema$node(HibernateObserver.kt:64) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver.persist(HibernateObserver.kt:50) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver.access$persist(HibernateObserver.kt:29) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver$Companion$install$1.call(HibernateObserver.kt:34) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver$Companion$install$1.call(HibernateObserver.kt:30) ~[corda-node-corda-3.0.jar:?]
at rx.internal.util.ActionSubscriber.onNext(ActionSubscriber.java:39) ~[rxjava-1.2.4.jar:1.2.4]
at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:134) ~[rxjava-1.2.4.jar:1.2.4]
... 44 more
Caused by: org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:231) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.util.SerializationHelper.deserialize(SerializationHelper.java:287) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.util.SerializationHelper.clone(SerializationHelper.java:75) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor$SerializableMutabilityPlan.deepCopyNotNull(SerializableTypeDescriptor.java:42) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor$SerializableMutabilityPlan.deepCopyNotNull(SerializableTypeDescriptor.java:31) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.descriptor.java.MutableMutabilityPlan.deepCopy(MutableMutabilityPlan.java:35) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.AbstractStandardBasicType.deepCopy(AbstractStandardBasicType.java:306) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.AbstractStandardBasicType.deepCopy(AbstractStandardBasicType.java:302) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.TypeHelper.deepCopy(TypeHelper.java:53) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:267) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:182) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:125) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:773) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:758) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at net.corda.node.services.schema.HibernateObserver.persistStatesWithSchema$node(HibernateObserver.kt:64) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver.persist(HibernateObserver.kt:50) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver.access$persist(HibernateObserver.kt:29) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver$Companion$install$1.call(HibernateObserver.kt:34) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver$Companion$install$1.call(HibernateObserver.kt:30) ~[corda-node-corda-3.0.jar:?]
at rx.internal.util.ActionSubscriber.onNext(ActionSubscriber.java:39) ~[rxjava-1.2.4.jar:1.2.4]
at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:134) ~[rxjava-1.2.4.jar:1.2.4]
... 44 more
Caused by: java.io.InvalidClassException: filter status: REJECTED
at java.io.ObjectInputStream.filterCheck(ObjectInputStream.java:1250) ~[?:1.8.0_151]
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1873) ~[?:1.8.0_151]
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1746) ~[?:1.8.0_151]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2037) ~[?:1.8.0_151]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1568) ~[?:1.8.0_151]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:428) ~[?:1.8.0_151]
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:225) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.util.SerializationHelper.deserialize(SerializationHelper.java:287) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.util.SerializationHelper.clone(SerializationHelper.java:75) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor$SerializableMutabilityPlan.deepCopyNotNull(SerializableTypeDescriptor.java:42) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor$SerializableMutabilityPlan.deepCopyNotNull(SerializableTypeDescriptor.java:31) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.descriptor.java.MutableMutabilityPlan.deepCopy(MutableMutabilityPlan.java:35) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.AbstractStandardBasicType.deepCopy(AbstractStandardBasicType.java:306) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.AbstractStandardBasicType.deepCopy(AbstractStandardBasicType.java:302) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.type.TypeHelper.deepCopy(TypeHelper.java:53) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:267) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:182) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:125) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:189) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:132) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:58) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:773) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:758) ~[hibernate-core-5.2.6.Final.jar:5.2.6.Final]
at net.corda.node.services.schema.HibernateObserver.persistStatesWithSchema$node(HibernateObserver.kt:64) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver.persist(HibernateObserver.kt:50) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver.access$persist(HibernateObserver.kt:29) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver$Companion$install$1.call(HibernateObserver.kt:34) ~[corda-node-corda-3.0.jar:?]
at net.corda.node.services.schema.HibernateObserver$Companion$install$1.call(HibernateObserver.kt:30) ~[corda-node-corda-3.0.jar:?]
at rx.internal.util.ActionSubscriber.onNext(ActionSubscriber.java:39) ~[rxjava-1.2.4.jar:1.2.4]
at rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:134) ~[rxjava-1.2.4.jar:1.2.4]
... 44 more
答案 0 :(得分:0)