# ktor

Evan Bennett

06/17/2019, 1:11 AM
I am trying to setup my ktor session cookie to contain a session UUID and the locale for the user. I have to following in `fun io.ktor.application.Application.main()`:
Copy code
install(Sessions) {
		val sessionCookieKey = io.ktor.util.hex("ktor.session.cookie.key").getString())
		fun configureCookie(): CookieSessionBuilder<*>.() -> Unit = {
			cookie.duration = null
			cookie.domain = null
			cookie.path = "/" = true
			cookie.httpOnly = true
			cookie.extensions["SameSite"] = "Strict"
		cookie<my.type.UuidV4>("SESSION_UUID", configureCookie())
		cookie<java.util.Locale>("LOCALE", configureCookie())
I am getting an exception when I make a request to the server. (Which I will post as a reply.) After looking in to this for a while, it appears that the
[var java.util.Locale.baseLocale: sun.util.locale.BaseLocale!, var java.util.Locale.localeExtensions: sun.util.locale.LocaleExtensions!, var java.util.Locale.hashCodeValue: <http://kotlin.Int|kotlin.Int>, var java.util.Locale.languageTag: kotlin.String!]
which are all
private transient
members of the
class. Is this a bug, or should I be doing this differently?
Exception in thread "nettyCallPool-4-1" kotlin.reflect.full.IllegalCallableAccessException: java.lang.IllegalAccessException: class kotlin.reflect.jvm.internal.calls.CallerImpl$FieldGetter cannot access a member of class java.util.Locale (in module java.base) with modifiers "private transient" at at kotlin.reflect.jvm.internal.KProperty1Impl.get(KProperty1Impl.kt:35) at io.ktor.sessions.SessionSerializerReflection.serialize(SessionSerializerReflection.kt:65) at at io.ktor.sessions.Sessions$Feature$install$2.invokeSuspend(Sessions.kt:82) at io.ktor.sessions.Sessions$Feature$install$2.invoke(Sessions.kt)
I could not post the exception in a reply as it was too long.