-
Notifications
You must be signed in to change notification settings - Fork 39
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
Registered Jackson Module is not used #2001
Comments
When are you registering the module? |
public static void main(String[] args) {
JsonSupport.getObjectMapper().registerModule(new VavrModule());
logger.info("Starting Kalix Application");
SpringApplication.run(Main.class, args);
} I didn't see the Kotlin template so can't comment on that. |
That's how it's done in the Kotlin template. In the main function before starting application. I don't see a reason for that to fail tough. Can you post here the full exception stack trace? |
This is the error I get when I change the java.uitl.List to io.vavr.collection.List in the command send to the workflow via componentClient. Similar is for events and state. kalix.javasdk.impl.WorkflowExceptions$WorkflowException: Unexpected failure: java.lang.IllegalArgumentException: JSON with type url [json.kalix.io/object] could not be decoded into a [com.example.uprotocol.petapp.datamodel.SetupModel$ProcessDiscoveryReplyCommand]. Make sure that changes are backwards compatible or apply a @Migration mechanism (https://docs.kalix.io/java/serialization.html#_schema_evolution).
at kalix.javasdk.impl.WorkflowExceptions$WorkflowException$.apply(WorkflowExceptions.scala:46)
at kalix.javasdk.impl.workflow.WorkflowImpl.liftedTree1$1(WorkflowImpl.scala:298)
at kalix.javasdk.impl.workflow.WorkflowImpl.$anonfun$runWorkflow$6(WorkflowImpl.scala:291)
at akka.stream.impl.fusing.MapAsyncUnordered$$anon$31.onPush(Ops.scala:1430)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:542)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:423)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:650)
at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:521)
at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:625)
at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:800)
at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$shortCircuitBatch(ActorGraphInterpreter.scala:787)
at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:819)
at akka.actor.Actor.aroundReceive(Actor.scala:537)
at akka.actor.Actor.aroundReceive$(Actor.scala:535)
at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:716)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:579)
at akka.actor.ActorCell.invoke(ActorCell.scala:547)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270)
at akka.dispatch.Mailbox.run(Mailbox.scala:231)
at akka.dispatch.Mailbox.exec(Mailbox.scala:243)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.lang.IllegalArgumentException: JSON with type url [json.kalix.io/object] could not be decoded into a [com.example.uprotocol.petapp.datamodel.SetupModel$ProcessDiscoveryReplyCommand]. Make sure that changes are backwards compatible or apply a @Migration mechanism (https://docs.kalix.io/java/serialization.html#_schema_evolution).
at kalix.javasdk.JsonSupport.jsonProcessingException(JsonSupport.java:189)
at kalix.javasdk.JsonSupport.decodeJson(JsonSupport.java:176)
at kalix.javasdk.impl.reflection.ParameterExtractors$.kalix$javasdk$impl$reflection$ParameterExtractors$$decodeParam(ParameterExtractor.scala:66)
at kalix.javasdk.impl.reflection.ParameterExtractors$BodyExtractor.extract(ParameterExtractor.scala:86)
at kalix.javasdk.impl.reflection.ParameterExtractors$BodyExtractor.extract(ParameterExtractor.scala:81)
at kalix.javasdk.impl.MethodInvoker.$anonfun$invoke$1(CommandHandler.scala:78)
at scala.collection.ArrayOps$.map$extension(ArrayOps.scala:934)
at kalix.javasdk.impl.MethodInvoker.invoke(CommandHandler.scala:78)
at kalix.javasdk.impl.workflow.ReflectiveWorkflowRouter.handleCommand(ReflectiveWorkflowRouter.scala:54)
at kalix.javasdk.impl.workflow.WorkflowRouter._internalHandleCommand(WorkflowRouter.scala:108)
at kalix.javasdk.impl.workflow.WorkflowImpl.liftedTree1$1(WorkflowImpl.scala:292)
... 23 common frames omitted
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `io.vavr.collection.List` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
at [Source: (byte[])"{"topics":{"head":"ultifi://vcu.veh1.veh.ultifi.gm.com/body.cabin_climate/1/system_settings#SystemSettings","tail":{"head":"ultifi:https://vcu.veh1.veh.ultifi.gm.com/body.cabin/1/door#left","tail":{"empty":true,"lazy":false,"traversableAgain":true,"async":false,"sequential":true,"ordered":false,"singleValued":false,"distinct":false,"orNull":null,"memoized":false},"length":1,"empty":false,"lazy":false,"traversableAgain":true,"async":false,"sequential":true,"ordered":false,"singleValued":false,"distinct"[truncated 361 bytes]; line: 1, column: 11] (through reference chain: com.example.uprotocol.petapp.datamodel.SetupModel$ProcessDiscoveryReplyCommand["topics"])
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
at com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1915)
at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:414)
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1360)
at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserialize(AbstractDeserializer.java:274)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:545)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeWithErrorWrapping(BeanDeserializer.java:568)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:439)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1409)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:352)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:185)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4825)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3833)
at kalix.javasdk.JsonSupport.decodeJson(JsonSupport.java:173)
... 32 common frames omitted
13:18:00.077 ERROR kalix.javasdk.impl.DiscoveryImpl - Error reported from Kalix system: KLX-01000 Workflow [com.example.uprotocol.petapp.SetupWorkflow], id [veh1] unexpected error [d34a7519-16c5-41ee-ad9e-c6fc03c4985e] |
Registered Jackson module in Kalix
JsonSupport.getObjectMapper()
is not picked up.Examaple:
Exception:
Vanilla moduel test works as expected:
The text was updated successfully, but these errors were encountered: