org.hibernate.AnnotationException is not annotated or on the whitelist

五迷三道 提交于 2019-12-25 01:34:28

问题


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.


回答1:


The issue is as follows:

  • Your code is throwing an org.hibernate.AnnotationException
  • The node is trying to send this exception back to the client over RPC, or to another node as part of a flow
  • For security purposes, only whitelisted classes can be serialised and sent within flows or over RPC
  • The exception class is not whitelisted, so a serialisation exception is thrown instead

Once you whitelist the exception class, it will be serialised and returned properly, allowing you to diagnose the underlying issue.

Adding classes to the whitelist

You can add classes to this whitelist by:

  • Adding the @CordaSerializable annotation to the class

    @CordaSerializable
    class MyClass
    
  • Adding it to the serialisation whitelist:

    class TemplateSerializationWhitelist : SerializationWhitelist {
        override val whitelist: List<Class<*>> = listOf(MyClass::class.java)
    }
    

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.



来源:https://stackoverflow.com/questions/47633652/org-hibernate-annotationexception-is-not-annotated-or-on-the-whitelist

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!