Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kotlinx.serialization.SerializationException: Serializer for class 'ArrayList' is not found. #29336

Closed
qaltrakadmin opened this issue Nov 17, 2022 · 4 comments · Fixed by #29373
Assignees
Labels
area/kotlin kind/bug Something isn't working
Milestone

Comments

@qaltrakadmin
Copy link

Describe the bug

Hi,
thanks for the fix of #28134

But it looks like this has introduced a new issue.
When using Lists, with a ResponseBuilder RestResponse.ResponseBuilder.ok(mutableListOf("apples"))

Expected behavior

I expect a response body should be ["apples"].

Actual behavior

Respnse:

{
  "details": "Error id b288077d-623f-4ae7-b765-93707f52a6f5-2, kotlinx.serialization.SerializationException: Serializer for class 'ArrayList' is not found.",
  "stack": "kotlinx.serialization.SerializationException: Serializer for class 'ArrayList' is not found.\nMark the class as @Serializable or provide the serializer explicitly.\n\tat kotlinx.serialization.internal.PlatformKt.serializerNotRegistered(Platform.kt:32)\n\tat kotlinx.serialization.SerializersKt__SerializersJvmKt.serializer(SerializersJvm.kt:60)\n\tat kotlinx.serialization.SerializersKt.serializer(Unknown Source)\n\tat kotlinx.serialization.SerializersKt__SerializersJvmKt.serializer(SerializersJvm.kt:30)\n\tat kotlinx.serialization.SerializersKt.serializer(Unknown Source)\n\tat io.quarkus.resteasy.reactive.kotlin.serialization.runtime.KotlinSerializationMessageBodyWriter.writeResponse(KotlinSerializationMessageBodyWriter.kt:44)\n\tat org.jboss.resteasy.reactive.server.core.ServerSerialisers.invokeWriter(ServerSerialisers.java:220)\n\tat org.jboss.resteasy.reactive.server.core.ServerSerialisers.invokeWriter(ServerSerialisers.java:191)\n\tat org.jboss.resteasy.reactive.server.core.serialization.FixedEntityWriter.write(FixedEntityWriter.java:28)\n\tat org.jboss.resteasy.reactive.server.handlers.ResponseWriterHandler.handle(ResponseWriterHandler.java:34)\n\tat io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:120)\n\tat org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)\n\tat io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:564)\n\tat org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)\n\tat org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)\n\tat org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)\n\tat org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.base/java.lang.Thread.run(Thread.java:833)"
}

Stack trace:

2022-11-16 19:43:33,173 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (executor-thread-0) Request failed: kotlinx.serialization.SerializationException: Serializer for class 'ArrayList' is not found.
Mark the class as @Serializable or provide the serializer explicitly.
	at kotlinx.serialization.internal.PlatformKt.serializerNotRegistered(Platform.kt:32)
	at kotlinx.serialization.SerializersKt__SerializersJvmKt.serializer(SerializersJvm.kt:60)
	at kotlinx.serialization.SerializersKt.serializer(Unknown Source)
	at kotlinx.serialization.SerializersKt__SerializersJvmKt.serializer(SerializersJvm.kt:30)
	at kotlinx.serialization.SerializersKt.serializer(Unknown Source)
	at io.quarkus.resteasy.reactive.kotlin.serialization.runtime.KotlinSerializationMessageBodyWriter.writeResponse(KotlinSerializationMessageBodyWriter.kt:44)
	at org.jboss.resteasy.reactive.server.core.ServerSerialisers.invokeWriter(ServerSerialisers.java:220)
	at org.jboss.resteasy.reactive.server.core.ServerSerialisers.invokeWriter(ServerSerialisers.java:191)
	at org.jboss.resteasy.reactive.server.core.serialization.FixedEntityWriter.write(FixedEntityWriter.java:28)
	at org.jboss.resteasy.reactive.server.handlers.ResponseWriterHandler.handle(ResponseWriterHandler.java:34)
	at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:120)
	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:564)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)

How to Reproduce?

Reproducer: https://github.com/qaltrak/Serializer-error-demo

  1. start dev server
  2. Restful GET on /hello

Output of uname -a or ver

Darwin OlufemisworkMBP.localdomain 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12-39) OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.14.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

------------------------------------------------------------ Gradle 7.4.2 ------------------------------------------------------------ Build time: 2022-03-31 15:25:29 UTC Revision: 540473b8118064efcc264694cbcaa4b677f61041 Kotlin: 1.5.31 Groovy: 3.0.9 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM: 17.0.1 (Oracle Corporation 17.0.1+12-39) OS: Mac OS X 12.5.1 aarch64

Additional information

No response

@qaltrakadmin qaltrakadmin added the kind/bug Something isn't working label Nov 17, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 17, 2022

/cc @evanchooly, @geoand

@geoand
Copy link
Contributor

geoand commented Nov 17, 2022

Thanks for reporting.

I'll have a look soon

@qaltrakadmin
Copy link
Author

Thanks @geoand

@geoand
Copy link
Contributor

geoand commented Nov 21, 2022

#29373 takes care of the problem

@quarkus-bot quarkus-bot bot added this to the 2.15 - main milestone Nov 21, 2022
geoand added a commit that referenced this issue Nov 21, 2022
Ensure proper generic type is used with RestResponse
@gsmet gsmet modified the milestones: 2.15 - main, 2.14.2.Final Nov 22, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Nov 22, 2022
@gsmet gsmet modified the milestones: 2.14.2.Final, 2.13.6.Final Dec 14, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kotlin kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants