[BUG] - Deserialization Failed while getting devices using Hybrid Network Library
See original GitHub issueDescribe the bug I am trying to get the hybrid network details from my subscription. I tried with the resource group name, resource id but getting Deserialization failed issue. Within Hybrid Network library, its failing so what can be done here ?
Exception or Stack Trace
Could not resolve type id 'AzureStackEdge' as a subtype of com.azure.resourcemanager.hybridnetwork.fluent.models.DevicePropertiesFormat: known type ids = [DevicePropertiesFormat] (for POJO property 'properties')\n at [Source: (byte[])"{"value":[{"id":"/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.HybridNetwork/devices/deviceName","name":"deviceName","type":"microsoft.hybridnetwork/devices","location":"eastus","tags":{},"systemData":{"createdBy":"emailId","createdByType":"User","createdAt":"2022-04-22T10:49:29.5758982Z","lastModifiedBy":"b8ed041c-aa91-418e-8f47-20c70abc2de1","lastModifiedByType":"Application","lastModifiedAt":"2022-09-28T0"[truncated 616 bytes]; line: 1, column: 601] (through reference chain: com.azure.resourcemanager.hybridnetwork.models.DeviceListResult["value"]->java.util.ArrayList[0]->com.azure.resourcemanager.hybridnetwork.fluent.models.DeviceInner["properties"]
at com.fasterxml.jackson.databind.exc.InvalidTypeIdException.from(InvalidTypeIdException.java:43) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.DeserializationContext.invalidTypeIdException(DeserializationContext.java:2073) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownTypeId(DeserializationContext.java:1564) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._handleUnknownTypeId(TypeDeserializerBase.java:298) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:165) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:125) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:110) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeWithType(BeanDeserializerBase.java:1292) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:147) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:313) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:176) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:355) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:313) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:176) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4674) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3723) ~[jackson-databind-2.13.3.jar:2.13.3]
at com.azure.core.implementation.jackson.ObjectMapperShim.readValue(ObjectMapperShim.java:224) ~[azure-core-1.29.1.jar:1.29.1]
at com.azure.core.util.serializer.JacksonAdapter.lambda$deserialize$8(JacksonAdapter.java:225) ~[azure-core-1.29.1.jar:1.29.1]
at com.azure.core.util.serializer.JacksonAdapter.useAccessHelper(JacksonAdapter.java:271) ~[azure-core-1.29.1.jar:1.29.1]
at com.azure.core.util.serializer.JacksonAdapter.deserialize(JacksonAdapter.java:223) ~[azure-core-1.29.1.jar:1.29.1]
at com.azure.core.implementation.serializer.HttpResponseBodyDecoder.deserializeBody(HttpResponseBodyDecoder.java:144) ~[azure-core-1.29.1.jar:1.29.1]
at com.azure.core.implementation.serializer.HttpResponseBodyDecoder.decodeByteArray(HttpResponseBodyDecoder.java:85) ~[azure-core-1.29.1.jar:1.29.1]
To Reproduce To reproduce this issue, you need to add a Network Function added to your resource group.
Code Snippet
private TokenCredential getAzureCredential(AzureProfile profile) {
return new DefaultAzureCredentialBuilder().authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()).build();
}
private AzureProfile getAzureProfile() {
return new AzureProfile(AzureEnvironment.AZURE);
}
private HybridNetworkManager authenticateHybridNetworkManager() {
AzureProfile profile = getAzureProfile();
return HybridNetworkManager.configure().authenticate(getAzureCredential(profile), getAzureProfile());
}
HybridNetworkManager hybridNetworkManager = authenticateHybridNetworkManager();
PagedIterable<Device> devices = hybridNetworkManager.devices().listByResourceGroup(RESOURCE_GROUP);
for (Device device : devices) {
System.out.println(device.id());
}
Expected behavior It should give the details of device, its state and other properties.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Casting interfaces for deserialization in JSON.NET
Will produce the error: Could not create an instance of type IThingy. Type is an interface or abstract class and cannot be instantiated....
Read more >Cisco Firepower Release Notes, Version 6.6 - Security
Open Bugs in Version 6.6.0 ; CSCvt66906. AppId looks up in dynamic cache even when it finds apps in a session ; CSCvt68316....
Read more >CVE-2019-18935: Remote Code Execution via Insecure…
It insecurely deserializes JSON objects in a manner that results in arbitrary remote code execution on the software's underlying host. The ...
Read more >CVE-2021-44521: RCE Vulnerability in Apache Cassandra
StressD RCE via unsafe object deserialization ... Cassandra includes a tool called cassandra-stressd which is used to stress-test the database.
Read more >An In-depth Study of Java Deserialization Remote-Code ...
A gadget can be used during a deserialization attack when the corresponding gadget library is included in the classpath of the vulnerable ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also,
AzureStackEdge
is added later than SDK 1.0.0-beta.1, in PR https://github.com/Azure/azure-rest-api-specs/pull/16316Service seems never requested a re-release of SDK after their change in backend/spec.
Thank you @weidongxu-microsoft for releasing the fix and its working now.