Skip to content

Occur exception using sitewhere-java-client api #28

@githubin80

Description

@githubin80

When I use sitewhere-java-client api ,occur the following exceptions:
ISiteWhereClient.getDeviceByToken(tenantAuthentication, devicetoken)
Exception in thread "main" com.sitewhere.spi.SiteWhereException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "asset" (class com.sitewhere.rest.model.device.DeviceAssignment), not marked as ignorable (15 known properties: "areaId", "updatedDate", "deviceTypeId", "metadata", "deviceId", "updatedBy", "activeDate", "createdDate", "token", "id", "createdBy", "assetId", "status", "customerId", "releasedDate"]) at [Source: (okhttp3.ResponseBody$BomAwareReader); line: 1, column: 1013] (through reference chain: com.sitewhere.rest.model.device.marshaling.MarshaledDevice["activeDeviceAssignments"]->java.util.ArrayList[0]->com.sitewhere.rest.model.device.DeviceAssignment["asset"]) at com.sitewhere.rest.client.SiteWhereClient.processRestCall(SiteWhereClient.java:2469) at com.sitewhere.rest.client.SiteWhereClient.getDeviceByToken(SiteWhereClient.java:1953) at com.techtotop.device.domain.TestSitewhereClient.getDevice(TestSitewhereClient.java:172) at com.techtotop.device.domain.TestSitewhereClient.main(TestSitewhereClient.java:75) Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "asset" (class com.sitewhere.rest.model.device.DeviceAssignment), not marked as ignorable (15 known properties: "areaId", "updatedDate", "deviceTypeId", "metadata", "deviceId", "updatedBy", "activeDate", "createdDate", "token", "id", "createdBy", "assetId", "status", "customerId", "releasedDate"]) at [Source: (okhttp3.ResponseBody$BomAwareReader); line: 1, column: 1013] (through reference chain: com.sitewhere.rest.model.device.marshaling.MarshaledDevice["activeDeviceAssignments"]->java.util.ArrayList[0]->com.sitewhere.rest.model.device.DeviceAssignment["asset"]) at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61) at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:840) at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1206) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1592) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1570) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:294) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27) 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.ObjectReader._bindAndClose(ObjectReader.java:1719) at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1244) at retrofit2.converter.jackson.JacksonResponseBodyConverter.convert(JacksonResponseBodyConverter.java:32) at retrofit2.converter.jackson.JacksonResponseBodyConverter.convert(JacksonResponseBodyConverter.java:23) at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:223) at retrofit2.OkHttpCall.execute(OkHttpCall.java:186) at com.sitewhere.rest.client.SiteWhereClient.processRestCall(SiteWhereClient.java:2462) ... 3 more

And the api ISiteWhereClient.updateDevice(tenantAuthentication, "testtoken", deviceRequest) has the same exception. Once the device has DeviceAssignment to assert, the exception appears.

SiteWhere version 2.1.0, and sitewhere-java-client version 2.1.x and 2.2.0.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions