Skip to content

Conversation

@pavliuc75
Copy link
Contributor

@pavliuc75 pavliuc75 commented Dec 4, 2024

changed auditable to use kotlinx.datetime.Instant
#136

@pavliuc75 pavliuc75 marked this pull request as ready for review December 12, 2024 11:00
@pavliuc75
Copy link
Contributor Author

the problem was that the converter would only work with the existing records from db.
the converter works for javainstant<->kotlininstant
when a new db record is created, spring uses java.time.localdatetime by default
since we only have a converter between javainstant<->kotlininstant and not localdatetime, this is what was causing the problem.
the solution is changing the default spring configuration to use javainstant for auditing

@yuanchen233
Copy link
Collaborator

When go in Deployments in the portal,

10:47:29.749 [http-nio-8080-exec-2] INFO  d.c.c.w.s.controller.StudyController - Start GET: /api/studies/ca4f7ecf-6b74-4c58-b4b4-f5e4a81ad514/participantGroup/status
10:47:30.026 [http-nio-8080-exec-9] ERROR d.c.c.w.c.e.advices.ExceptionAdvices - Uncaught Exception: CarpErrorResponse(statusCode=500, exception=java.lang.ClassCastException, message=class kotlinx.datetime.Instant cannot be cast to class java.time.Instant (kotlinx.datetime.Instant is in unnamed module of loader 'app'; java.time.Instant is in module java.base of loader 'bootstrap'), path=GET /api/studies/ca4f7ecf-6b74-4c58-b4b4-f5e4a81ad514/participantGroup/status)
10:47:30.028 [http-nio-8080-exec-9] WARN  o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver - Resolved [java.lang.ClassCastException: class kotlinx.datetime.Instant cannot be cast to class java.time.Instant (kotlinx.datetime.Instant is in unnamed module of loader 'app'; java.time.Instant is in module java.base of loader 'bootstrap')]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants