I am trying to setup my ktor session cookie to con...
# ktor
e
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(environment.config.property("ktor.session.cookie.key").getString())
		fun configureCookie(): CookieSessionBuilder<*>.() -> Unit = {
			cookie.duration = null
			cookie.domain = null
			cookie.path = "/"
			cookie.secure = true
			cookie.httpOnly = true
			cookie.extensions["SameSite"] = "Strict"
			transform(SessionTransportTransformerMessageAuthentication(sessionCookieKey))
		}
		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
SessionSerializerReflection.properties
contains
[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
java.util.Locale
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 kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:224) at kotlin.reflect.jvm.internal.KProperty1Impl.get(KProperty1Impl.kt:35) at io.ktor.sessions.SessionSerializerReflection.serialize(SessionSerializerReflection.kt:65) at io.ktor.sessions.SessionTrackerByValue.store(SessionTrackerByValue.kt:30) 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.