0
votes

I am using Springboot RPC webserver to run my apis. I have put java.util.Date in Whitelist still throwing error.

Class java.util.Date is not annotated or on the whitelist, so cannot be used in serialization

I created a class

import net.corda.core.serialization.SerializationWhitelist

class RequiredSerializationWhitelist : SerializationWhitelist {
    override val whitelist: List<Class<*>> = listOf(java.util.Date::class.java)
}

and put the file net.corda.core.serialization.SerializationWhitelist in \src\main\resources\META-INF\services with following code

com.p2p.RequiredSerializationWhitelist

While deploying Nodes I get

No existing whitelist file found.
Calculating whitelist for current installed CorDapps..
CorDapp whitelist generated in <path>\build\nodes\whitelist.txt
Updating whitelist
Bootstrapping complete!

When I open my Whitelist file in the path given only my Contracts are shown. What am I missing.

1
Found the reason the jar was getting skipped when assembling so created the whitelist files in the root of the project - Karan Kulwal

1 Answers

0
votes

I think there are not the same whitelist. \build\nodes\whitelist.txt is file for Corda contract whitelist class. But your problem is net.corda.core.serialization.SerializationWhitelist that should be in JAR file under META-INF/services. Can you check that in your JAR file and this path it's contain SerializationWhitelist file?