Skip to content
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

Occur exception using sitewhere-java-client api #28

Open
githubin80 opened this issue Mar 10, 2020 · 3 comments
Open

Occur exception using sitewhere-java-client api #28

githubin80 opened this issue Mar 10, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@githubin80
Copy link

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.

@derekadams derekadams self-assigned this Mar 10, 2020
@derekadams
Copy link
Member

We made some changes to the APIs around the 2.1 release and the Java client library may have been out of sync with the updates. We will take a look at the issue and try to find a workaround.

@jorgevillaverde-sitewhere
Copy link
Contributor

@githubin80 I'm moving this issue to sitewhere-java-api repository for better tracking of the issue

@jorgevillaverde-sitewhere jorgevillaverde-sitewhere transferred this issue from sitewhere/sitewhere Mar 11, 2020
@jorgevillaverde-sitewhere
Copy link
Contributor

@githubin80 we have release sitewhere-java-client version 2.1.13 to maven central.
Let us know if this solved the problem

@jorgevillaverde-sitewhere jorgevillaverde-sitewhere added the bug Something isn't working label Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants