问题描述
我已经为模式中的主键声明添加了@Id.构建并成功运行.但是它的显示为org.hibernate.AnnotationException类,没有注释或不在白名单上,因此不能在序列化中使用序列化跟踪:cause(rx.exceptions.OnErrorNotImplementedException)throwable(rx.Notification).我也添加了@corda可序列化.请帮帮我.
I have tired to add @Id for primary key declaration in schema. build and ran successfully. But its shows as Class org.hibernate.AnnotationException is not annotated or on the whitelist, so cannot be used in serialization Serialization trace: cause (rx.exceptions.OnErrorNotImplementedException) throwable (rx.Notification) . i added @corda serializable too. please help me out.
推荐答案
问题如下:
- 您的代码引发了
org.hibernate.AnnotationException
- 该节点正在尝试将此异常通过RPC发送回客户端,或作为流的一部分发送给另一个节点
- 出于安全目的,只能将白名单类进行序列化并在流内或通过RPC发送
- 该异常类未列入白名单,因此将引发序列化异常
一旦将异常类列入白名单,它将被序列化并正确返回,从而使您能够诊断出潜在的问题.
Once you whitelist the exception class, it will be serialised and returned properly, allowing you to diagnose the underlying issue.
将课程添加到白名单
您可以通过以下方式将类添加到此白名单:
You can add classes to this whitelist by:
-
在类中添加
@CordaSerializable
批注
@CordaSerializable
class MyClass
将其添加到序列化白名单中:
Adding it to the serialisation whitelist:
class TemplateSerializationWhitelist : SerializationWhitelist {
override val whitelist: List<Class<*>> = listOf(MyClass::class.java)
}
然后,必须将序列化白名单插件的标准类名添加到 src/main/resources/META-INF中名为
文件夹. net.corda.core.serialization.SerializationWhitelist
的文件中/services
The serialization whitelist plugin's fully-qualified class name must then be added to a file called net.corda.core.serialization.SerializationWhitelist
in the src/main/resources/META-INF/services
folder.
这篇关于org.hibernate.AnnotationException未注释或在白名单上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!