Problem with parent project and SDK module

Caused by: java.lang.ClassCastException: class com.inductiveautomation.ignition.common.script.ProjectScriptModule cannot be cast to class com.inductiveautomation.ignition.common.Dataset (com.inductiveautomation.ignition.common.script.ProjectScriptModule and com.inductiveautomation.ignition.common.Dataset are in unnamed module of loader 'app')

I really don't think the gateway scripting project is relevant at all here.

I think that Gateway Scripting Project is relevant, because when I write the name of any project the module stops working and when it is empty it works correctly, as if I am missing to configure something inside the module to work from the gateway of that project.
it is as if when defining a project, it will not find the module to perform the task, so the incomplete script cannot be executed and presents the error.

Okay, so whether it's set might be relevant to how you hit it, but unconditionally, the problem lies in your code; you've got a variable that's a ProjectScriptModule (somehow) but you're trying to cast it to a Dataset.

1 Like

Hi PGriffith, I was checking more in detail the error message and I found that the PyObject I get from the StringMap varies its order according to where it is executed, and one of the dataset was linked to a fixed position to extract the data, I changed this line:

Dataset ds = (Dataset) stringMap.values().get(0);

To the following:

Dataset ds = (Dataset) stringMap.__finditem__("ds2").__tojava__(java.lang.Object.class);

thank you very much for all the help

1 Like