Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-1709

KieServicesException: Error while deserializing data received from server!

XMLWordPrintable

    • Hide

      KieServicesConfiguration cfg = KieServicesFactory.newRestConfiguration(serverUrl, user, password);
      cfg.setMarshallingFormat(MarshallingFormat.JSON);
      Set<Class<?>> extraClasses = new HashSet<Class<?>>();
      extraClasses.add(TmOt.class);
      .
      .
      .
      cfg.addExtraClasses(extraClasses);
      KieServicesClient kieServicesClient = KieServicesFactory.newKieServicesClient(cfg);
      RuleServicesClient ruleClient = kieServicesClient.getServicesClient(RuleServicesClient.class);
      List<Command<?>> commands = new ArrayList<Command<?>>();
      KieCommands commandsFactory = KieServices.Factory.get().getCommands();
      BatchExecutionCommand batchExecution = commandsFactory.newBatchExecution(commands, kieSession);
      commands.add(commandsFactory.newInsert(factOrder, ORDER_IDENTIFIER));
      commands.add(commandsFactory.newFireAllRules());
      commands.add(commandsFactory.newGetObjects(GET_OBJECTS_IDENTIFIER))
      ServiceResponse<ExecutionResults> response = ruleClient.executeCommandsWithResults(containerId, batchExecution);
      ExecutionResults actualData = response.getResult();

      It crashes at response.

      Show
      KieServicesConfiguration cfg = KieServicesFactory.newRestConfiguration(serverUrl, user, password); cfg.setMarshallingFormat(MarshallingFormat.JSON); Set<Class<?>> extraClasses = new HashSet<Class<?>>(); extraClasses.add(TmOt.class); . . . cfg.addExtraClasses(extraClasses); KieServicesClient kieServicesClient = KieServicesFactory.newKieServicesClient(cfg); RuleServicesClient ruleClient = kieServicesClient.getServicesClient(RuleServicesClient.class); List<Command<?>> commands = new ArrayList<Command<?>>(); KieCommands commandsFactory = KieServices.Factory.get().getCommands(); BatchExecutionCommand batchExecution = commandsFactory.newBatchExecution(commands, kieSession); commands.add(commandsFactory.newInsert(factOrder, ORDER_IDENTIFIER)); commands.add(commandsFactory.newFireAllRules()); commands.add(commandsFactory.newGetObjects(GET_OBJECTS_IDENTIFIER)) ServiceResponse<ExecutionResults> response = ruleClient.executeCommandsWithResults(containerId, batchExecution); ExecutionResults actualData = response.getResult(); It crashes at response.
    • NEW
    • NEW

      Hello,

      I'm trying to make working drools 7.1.0 FINAL but I'm getting unmarshalling input error when I'm sending an object with a joda DateTime attribute to kie-server. Seems like a bug while serializing/deserializing datetime object to json.

      Can someone help me please?

      org.kie.server.api.exception.KieServicesException: Error while deserializing data received from server!
      at org.kie.server.client.impl.AbstractKieServicesClientImpl.deserialize(AbstractKieServicesClientImpl.java:592)
      at org.kie.server.client.impl.AbstractKieServicesClientImpl.makeHttpPostRequestAndCreateServiceResponse(AbstractKieServicesClientImpl.java:286)
      at org.kie.server.client.impl.AbstractKieServicesClientImpl.makeHttpPostRequestAndCreateServiceResponse(AbstractKieServicesClientImpl.java:264)
      at org.kie.server.client.impl.RuleServicesClientImpl.executeCommandsWithResults(RuleServicesClientImpl.java:66)
      at kettle.resources.KieServerClient.fireKettleRules(KieServerClient.java:135)
      at kettle.application.NegocioBean.aplicarReglas(NegocioBean.java:102)
      at kettle.services.KettleService.recieveDataJson(KettleService.java:72)
      at KettleTester.main(KettleTester.java:37)
      Caused by: org.kie.server.api.marshalling.MarshallingException: Error unmarshalling input
      at org.kie.server.api.marshalling.json.JSONMarshaller.unmarshall(JSONMarshaller.java:279)
      at org.kie.server.client.impl.AbstractKieServicesClientImpl.deserialize(AbstractKieServicesClientImpl.java:590)
      ... 7 more
      Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of org.joda.time.Chronology, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information
      at [Source: {
      "type" : "SUCCESS",
      "msg" : "Container DEV successfully called.",
      "result" : {
      "execution-results" : {
      "results" : [ {
      "value" : [{
      "kettle.model.MensajesError" :

      { "tipoError" : null }

      },{
      "tws.hibernate.mappings.TmOt" : {
      "id" : 150078,
      "finishedAt" : {
      "dayOfMonth" : 19,
      "year" : 2017,
      "era" : 1,
      "dayOfYear" : 231,
      "dayOfWeek" : 6,
      "millisOfDay" : 46800000,
      "monthOfYear" : 8,
      "hourOfDay" : 13,
      "minuteOfHour" : 0,
      "secondOfMinute" : 0,
      "millisOfSecond" : 0,
      "weekOfWeekyear" : 33,
      "weekyear" : 2017,
      "yearOfEra" : 2017,
      "yearOfCentury" : 17,
      "centuryOfEra" : 20,
      "secondOfDay" : 46800,
      "minuteOfDay" : 780,
      "millis" : 1503140400000,
      "zone" : {
      "fixed" : false,
      "uncachedZone" :

      { "fixed" : false, "cachable" : true, "id" : "Europe/Madrid" }

      ,
      "id" : "Europe/Madrid"
      },
      "chronology" : {
      "zone" : {
      "fixed" : false,
      "uncachedZone" :

      { "fixed" : false, "cachable" : true, "id" : "Europe/Madrid" }

      ,
      "id" : "Europe/Madrid"
      }
      },
      "afterNow" : false,
      "beforeNow" : true,
      "equalNow" : false
      },
      "startedAt" : {
      "dayOfMonth" : 19,
      "year" : 2017,
      "era" : 1,
      "dayOfYear" : 231,
      "dayOfWeek" : 6,
      "millisOfDay" : 34200000,
      "monthOfYear" : 8,
      "hourOfDay" : 9,
      "minuteOfHour" : 30,
      "secondOfMinute" : 0,
      "millisOfSecond" : 0,
      "weekOfWeekyear" : 33,
      "weekyear" : 2017,
      "yearOfEra" : 2017,
      "yearOfCentury" : 17,
      "centuryOfEra" : 20,
      "secondOfDay" : 34200,
      "minuteOfDay" : 570,
      "millis" : 1503127800000,
      "zone" : {
      "fixed" : false,
      "uncachedZone" :

      { "fixed" : false, "cachable" : true, "id" : "Europe/Madrid" }

      ,
      "id" : "Europe/Madrid"
      },
      "chronology" : {
      "zone" : {
      "fixed" : false,
      "uncachedZone" :

      { "fixed" : false, "cachable" : true, "id" : "Europe/Madrid" }

      ,
      "id" : "Europe/Madrid"
      }
      },
      "afterNow" : false,
      "beforeNow" : true,
      "equalNow" : false
      }
      }},
      "key" : "orden"
      }, {
      "value" : {"kettle.model.MensajesError" :

      { "tipoError" : null }}

      ,
      "key" : "mensaje"
      } ],
      "facts" : [ {
      "value" : {"org.drools.core.common.DefaultFactHandle":

      { "external-form" : "0:1:242655221:1872950214:1:DEFAULT:NON_TRAIT:java.util.LinkedHashMap" }}

      ,
      "key" : "orden"
      }, {
      "value" : {"org.drools.core.common.DefaultFactHandle":

      { "external-form" : "0:2:1104605608:-2037841024:2:DEFAULT:NON_TRAIT:java.util.LinkedHashMap" }}

      ,
      "key" : "mensaje"
      } ]
      }
      }
      }; line: 88, column: 8] (through reference chain: org.kie.server.api.model.ServiceResponse["result"]>org.drools.core.runtime.impl.ExecutionResultImpl["results"]>Object[][0]>org.drools.core.xml.jaxb.util.JaxbStringObjectPair["value"]>tws.hibernate.mappings.TmOt["finishedAt"]->org.joda.time.DateTime["chronology"])
      at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
      at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:889)
      at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserialize(AbstractDeserializer.java:139)
      at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:520)
      at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:256)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
      at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:520)
      at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:95)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:256)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
      at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:3703)
      at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2006)
      at org.kie.server.api.marshalling.json.JSONMarshaller$CustomObjectDeserializer.mapObject(JSONMarshaller.java:667)
      at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.deserialize(UntypedObjectDeserializer.java:222)
      at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.mapArray(UntypedObjectDeserializer.java:356)
      at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.deserialize(UntypedObjectDeserializer.java:230)
      at com.fasterxml.jackson.databind.deser.std.StdDelegatingDeserializer.deserialize(StdDelegatingDeserializer.java:160)
      at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:520)
      at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:101)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:256)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
      at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:156)
      at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:17)
      at com.fasterxml.jackson.databind.deser.std.StdDelegatingDeserializer.deserialize(StdDelegatingDeserializer.java:160)
      at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:520)
      at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:101)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:256)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
      at com.fasterxml.jackson.databind.jsontype.impl.AsWrapperTypeDeserializer._deserialize(AsWrapperTypeDeserializer.java:114)
      at com.fasterxml.jackson.databind.jsontype.impl.AsWrapperTypeDeserializer.deserializeTypedFromAny(AsWrapperTypeDeserializer.java:64)
      at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializer.deserializeWithType(UntypedObjectDeserializer.java:289)
      at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:518)
      at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:101)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:256)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
      at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3731)
      at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2724)
      at org.kie.server.api.marshalling.json.JSONMarshaller.unmarshall(JSONMarshaller.java:277)
      ... 8 more

              swiderski.maciej Maciej Swiderski (Inactive)
              nicolaeturcan Nicolae Turcan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: