I was making basic changes to a login form and the POST handler is failing when I try to call
call.respondRedirecT("/")
Manas Marthi
02/23/2024, 7:45 AM
I added map<String, Any> to UserSession class. Session serialization does not like Any. It sassy no serialiser found. Annotate Any with ‘@Contextual’ . Not sure what it means
a
Aleksei Tirman [JB]
02/23/2024, 8:33 AM
The error occurs because the
Any
type doesn't have a serializer defined at the compile-time. You can read about the contextual serialization in the documentation of the kotlinx.serialization framework.
Have you resolved the problem with the
ClassNotFoundException
?
m
Manas Marthi
02/24/2024, 9:09 PM
Session serialization does not work when I use LocalDate members. I had to add
@Contexualize
annotation. I tried to use KTORM orm instead of Exposed ORM. That also seems to have caused error. I had to convert KTORM instances into a
@Serializable
data class object. Serialization fails when any object is of type
Any
. So trying to store a
Map<String,Any>
bombs out.
Manas Marthi
02/24/2024, 9:10 PM
It finally worked after I removed all
Any
properties and made the above mentioned changes
Manas Marthi
02/24/2024, 9:17 PM
KTORM ORM uses interfaces to define entity objects. So I can't add
@Serialziable
@Contextual annotations
. KTOR Sessions and KTORM entity objects don't work with each other as of now. Probably I will find a way forward when I am more familiar with Kotlin type system