getServerStatus() throws cast exception #854
ReinerZufall159
started this conversation in
General
Replies: 2 comments 2 replies
-
You will have to do something similar to the workaround suggested in #147 if you want to continue to use the UaNode API. You could also read the values directly using the NodeIds of the Nodes without using UaNode objects like in ReadExample.java. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Also if the server is really not reporting the correct type definition for nodes in its information model then this should be reported to the vendor of the server as well. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using following milo example: "ReadNodeExample", when i run the Code i got a classCastException. I am not testing against the milo test server, i test against a modular control version XC303.
UaException: status=Bad_UnexpectedError, message=java.util.concurrent.ExecutionException: java.lang.ClassCastException: org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNode cannot be cast to org.eclipse.milo.opcua.sdk.client.model.nodes.variables.ServerStatusTypeNode
at org.eclipse.milo.opcua.sdk.client.model.nodes.objects.ServerTypeNode.getServerStatusNode(ServerTypeNode.java:369)
at org.eclipse.milo.opcua.sdk.client.model.nodes.objects.ServerTypeNode.getServerStatus(ServerTypeNode.java:322)
at opcClient.TestPrint.serverType(TestPrint.java:189)
at opcClient.TestPrint.main(TestPrint.java:147)
Caused by: java.util.concurrent.ExecutionException: java.lang.ClassCastException: org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNode cannot be cast to org.eclipse.milo.opcua.sdk.client.model.nodes.variables.ServerStatusTypeNode
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
at org.eclipse.milo.opcua.sdk.client.model.nodes.objects.ServerTypeNode.getServerStatusNode(ServerTypeNode.java:367)
... 3 more
Caused by: java.lang.ClassCastException: org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNode cannot be cast to org.eclipse.milo.opcua.sdk.client.model.nodes.variables.ServerStatusTypeNode
at org.eclipse.milo.opcua.sdk.client.model.nodes.objects.ServerTypeNode.lambda$getServerStatusNodeAsync$23(ServerTypeNode.java:376)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:616)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:591)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1975)
at org.eclipse.milo.opcua.stack.client.UaStackClient.lambda$deliverResponse$5(UaStackClient.java:309)
at org.eclipse.milo.opcua.stack.core.util.ExecutionQueue$Task.run(ExecutionQueue.java:119)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
i know from #147 it is because the server return a wrong datatype which one cannot be cast. Is there a work around for this?
Beta Was this translation helpful? Give feedback.
All reactions