quarkus: Could not deserialize watch event - exception only when run in native mode
My small k8s object watcher app - https://github.com/iamvvra/k8swatcher - throws the below deserialization exception only when the app is run as binary, I never faced this exception running with maven or with the uber jar. I am connecting to an Openshift cluster.
2019-08-22 21:52:06,559 ERROR [io.fab.kub.cli.dsl.int.WatchConnectionManager] (OkHttp https://mycluster.com/...) Could not deserialize watch event: {"type":"ADDED","object":{"kind":"Pod","apiVersion":"v1","metadata":{" ...
com.fasterxml.jackson.databind.JsonMappingException: No resource type found for:v1#Pod
at [Source: (String)"{"type":"ADDED","object":{"kind":"Pod","apiVersion":"v1","metadata":{"name":"pod1-1-msbsr","generateName":"pod1-1-","namespace":"dev","selfLink":"/api/v1/namespaces/dev/pods/pod1-1-msbsr","uid":"5de8eead-c3e3-11e9-aac9-0050568753b2","resourceVersion":"117436928","creationTimestamp":"2019-08-21T07:14:51Z","labels":{"deployment":"deployment1-1","deploymentconfig":"deployment1-server","name":"app1"},"annotations":{"openshift.io/deployment-con"[truncated 2691 chars]; line: 1, column: 3189] (through reference chain: io.fabric8.kubernetes.api.model.WatchEvent["object"])
at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:1718)
at io.fabric8.kubernetes.internal.KubernetesDeserializer.deserialize(KubernetesDeserializer.java:79)
at io.fabric8.kubernetes.internal.KubernetesDeserializer.deserialize(KubernetesDeserializer.java:33)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4014)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3005)
at io.fabric8.kubernetes.client.dsl.internal.WatchHTTPManager.readWatchEvent(WatchHTTPManager.java:298)
at io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager$1.onMessage(WatchConnectionManager.java:229)
at okhttp3.internal.ws.RealWebSocket.onReadMessage(RealWebSocket.java:323)
at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.java:219)
at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:105)
at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:274)
at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:214)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:460)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
Expected behavior Should deserialize and provide the received value as object
To Reproduce Steps to reproduce the behavior:
- Write a program to watch an object, say Pod.
- Generate a binary, MAC
- Connect to a Kubernetes cluster - possibly it can be an Openshift.
Configuration
quarkus.kubernetes-client.trust-certs=true
quarkus.log.console.enable=true
quarkus.log.level=INF
Screenshots

Environment (please complete the following information):
- Output of
uname -aorver: Darwin vvra-mac.local 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64 - Output of
java -version: openjdk version “1.8.0_222” OpenJDK Runtime Environment (build 1.8.0_222-20190711112007.graal.jdk8u-src-tar-gz-b08) OpenJDK 64-Bit GraalVM CE 19.1.1 (build 25.222-b08-jvmci-19.1-b01, mixed mode) - GraalVM version (if different from Java): same as above
- Quarkus version or git rev: <quarkus.version>0.20.0</quarkus.version>
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (13 by maintainers)
Commits related to this issue
- Add documentation on how to properly write a Kubernetes watcher Fixes: #3653 — committed to geoand/quarkus by geoand 5 years ago
- Add documentation on how to properly write a Kubernetes watcher Fixes: #3653 — committed to geoand/quarkus by geoand 5 years ago
- Add documentation on how to properly write a Kubernetes watcher Fixes: #3653 — committed to geoand/quarkus by geoand 5 years ago
- Merge pull request #3665 from geoand/#3653 Add documentation on how to properly write a Kubernetes Watcher that works in native mode — committed to quarkusio/quarkus by geoand 5 years ago
- Refactored the watcher code for GAALVM native build - ref quarkusio/quarkus#3653 & quarkusio/quarkus#3665 — committed to iamvvra/k8swatcher by iamvvra 5 years ago
When I checked out your code there was no
EventMessageDeserializer. To get passed that problem, simply annotate that class with@RegisterForReflection@gastaldi In this specific case, yes. The augmentation phase could warn that no generic type could be bound / matched (I don’t know what the proper verb is here) for
com.k8swatcher.ResourceWatcherduring build time. That’s a very good idea actually. It might be a false warning in some cases, but probably best to warn anyway.I’ll open a PR later on for adding a warning and for documenting the coding pattern.
I was able to reproduce the problem. Looking into it now