# system.opcua.callMethod cannot be cast to class

**URL:** <https://forum.inductiveautomation.com/t/system-opcua-callmethod-cannot-be-cast-to-class/96429>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [September 25, 2024, 3:00pm UTC](https://forum.inductiveautomation.com/t/system-opcua-callmethod-cannot-be-cast-to-class/96429 "2024-09-25T15:00:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriel\_Iglesias](https://avatars.discourse-cdn.com/v4/letter/g/e95f7d/32.png) [@Gabriel\_Iglesias](https://forum.inductiveautomation.com/u/Gabriel_Iglesias)\
**Post date:** [September 25, 2024, 3:00pm UTC](https://forum.inductiveautomation.com/t/system-opcua-callmethod-cannot-be-cast-to-class/96429/1 "2024-09-25T15:00:34Z")

</div>

Hi. I'm trying to work with an OPC-UA server. On the OPC Browser I have the following configuration:

![opc_browser](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/5/15cf9d92737d7e56afa0d4a8db729ce1b703f8a2.png)

Then, I'm running the following code on a onStartup event:

```python
def runAction(self):
	output = system.opcua.callMethod(
		"OPC_Pedidos",
		"nsu=intercambio_pedidos_SCADA;i=1",
		"nsu=intercambio_pedidos_SCADA;i=25",
		[]
	)
	
	lista_param = output[2]

```

Where the following error appears:

Error running action 'system.onStartup' on Popups/popup\_estado\_actual@D: Traceback (most recent call last): File "function:runAction", line 4, in runAction java.lang.ClassCastException: class org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNode cannot be cast to class org.eclipse.milo.opcua.sdk.client.model.nodes.variables.PropertyTypeNode (org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNode and org.eclipse.milo.opcua.sdk.client.model.nodes.variables.PropertyTypeNode are in unnamed module of loader com.inductiveautomation.ignition.gateway.modules.ModuleClassLoader @603dec95) at org.eclipse.milo.opcua.sdk.client.nodes.UaNode.lambda$null$15(UaNode.java:1064) at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source) at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source) at java.base/java.util.concurrent.CompletableFuture.complete(Unknown Source) at org.eclipse.milo.opcua.stack.client.UaStackClient.lambda$deliverResponse$5(UaStackClient.java:318) at org.eclipse.milo.opcua.stack.core.util.ExecutionQueue$Task.run(ExecutionQueue.java:119) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) java.lang.ClassCastException: java.lang.ClassCastException: class org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNode cannot be cast to class org.eclipse.milo.opcua.sdk.client.model.nodes.variables.PropertyTypeNode (org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNode and org.eclipse.milo.opcua.sdk.client.model.nodes.variables.PropertyTypeNode are in unnamed module of loader com.inductiveautomation.ignition.gateway.modules.ModuleClassLoader @603dec95)

I know that the nodeId of the method and object are correct since prior to this I did a browse using system.opc.browse. The results were:

 ![nodeids](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/c/ac6d2cbc85cd84de106abc129df069e3e02dd236.png)

Any hints on why could this error be happening? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 25, 2024, 3:06pm UTC](https://forum.inductiveautomation.com/t/system-opcua-callmethod-cannot-be-cast-to-class/96429/2 "2024-09-25T15:06:51Z")

</div>

I have seen this before when the server address space is not modeled correctly or returning the right type definition for some Nodes, but without access to the server it will be difficult to confirm this is the issue.

Ignition 8.1.43 includes a new implementation of `system.opcua.callMethod` that works around certain bugs in FreeOpcUa-based servers, and it's possible this new implementation will help here as well.

If you aren't on 8.1.43 try upgrading.

---

<div class="post-metadata">

**Author:** ![Gabriel\_Iglesias](https://avatars.discourse-cdn.com/v4/letter/g/e95f7d/32.png) [@Gabriel\_Iglesias](https://forum.inductiveautomation.com/u/Gabriel_Iglesias)\
**Post date:** [September 26, 2024, 7:09pm UTC](https://forum.inductiveautomation.com/t/system-opcua-callmethod-cannot-be-cast-to-class/96429/3 "2024-09-26T19:09:49Z")

</div>

Hi Kevin, thanks for your answer. Indeed upgrading to version 8.1.43 solved this issue.
