-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Milestone
Description
Describe the bug
Using websocket next on current quarkus main (999-SNAPSHOT) the websocket fails so (de)serialize objects using default codec. See full exception bellow.
This does not happen when I specify custom codec (using @OnTextMessage(codec = Mycodec.class))
io.quarkus.websockets.next.TextEncodeException: Unable to encode text message with io.quarkus.websockets.next.runtime.JsonTextMessageCodec
at io.quarkus.websockets.next.runtime.Codecs.unableToEncode(Codecs.java:166)
at io.quarkus.websockets.next.runtime.Codecs.textEncode(Codecs.java:77)
at io.quarkus.websockets.next.runtime.WebSocketEndpointBase.encodeText(WebSocketEndpointBase.java:324)
at org.acme.websockets.ChatWebSocket_WebSocketServerEndpoint.doOnOpen(Unknown Source)
at io.quarkus.websockets.next.runtime.WebSocketEndpointBase$4.call(WebSocketEndpointBase.java:167)
at io.quarkus.websockets.next.runtime.WebSocketEndpointBase$4.call(WebSocketEndpointBase.java:161)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$4(ContextImpl.java:192)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:270)
at io.vertx.core.impl.ContextImpl$1.execute(ContextImpl.java:221)
at io.vertx.core.impl.WorkerTask.run(WorkerTask.java:56)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:638)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at [email protected]/java.lang.Thread.runWith(Thread.java:1596)
at [email protected]/java.lang.Thread.run(Thread.java:1583)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:896)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:872)
Caused by: java.lang.IllegalStateException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.acme.websockets.ChatWebSocket$ChatMessage and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS). This appears to be a native image, in which case you may need to configure reflection for the class that is to be serialized
at io.quarkus.websockets.next.runtime.JsonTextMessageCodec.encode(JsonTextMessageCodec.java:31)
at io.quarkus.websockets.next.runtime.JsonTextMessageCodec.encode(JsonTextMessageCodec.java:17)
at io.quarkus.websockets.next.runtime.Codecs.textEncode(Codecs.java:75)
... 20 more
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.acme.websockets.ChatWebSocket$ChatMessage and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS). This appears to be a native image, in which case you may need to configure reflection for the class that is to be serialized
at com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1328)
at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:414)
at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:49)
at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:30)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:502)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:341)
at com.fasterxml.jackson.databind.ObjectMapper._writeValueAndClose(ObjectMapper.java:4811)
at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:4052)
at io.quarkus.websockets.next.runtime.JsonTextMessageCodec.encode(JsonTextMessageCodec.java:29)
... 22 more
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
- Create app from websocket next tutorial - https://quarkus.io/version/main/guides/websockets-next-tutorial (or use websocket next quickstart
- Build it using
quarkus build --native - Start the app
target/websockets-next-quickstart-1.0.0-SNAPSHOT-runner - Try to connect to the backend on the web UI:
http://localhost:8080
Output of uname -a or ver
No response
Output of java -version
17.0.13
Mandrel or GraalVM version (if different from Java)
No response
Quarkus version or git rev
999-SNAPSHOT
Build tool (ie. output of mvnw --version or gradlew --version)
No response
Additional information
No response