Reading tag values

Dear All,

I am trying to read tag values in a gateway module, but I am not successful.
Can some one help me with an example or sample code?


Maybe you should let us know what you have tried so far and what did not work. Any error message?

You should just get the TagManager from the gatewayContext (gatewayContext.getTagManager()) and then just use the…

Hi, Thanks a lot for your mail.
I got the problem resolved.

I don’t have a SQLTagManagerContext in my version (I am on 7.6.1). So maybe there is a difference there. You might also want to use the TagPathParser class to build the TagPath object.




I’m new in Ignition SDK development and I’m trying to to simple read a TAG in Client scope, but I’m getting this error:

serializationException: Unexpected parsing error during binary deserialization.
caused by IOExceptionWithCause: java.lang.ClassNotFoundException: com.BirminD.PIDcomp.client.BirminD_PID_comp
caused by ClassNotFoundException: com.BirminD.PIDcomp.client.BirminD_PID_comp

Ignition v7.8.2 (b2016030813)
Java: Oracle Corporation 1.8.0_91

My code is:

TagPath path = TagPathParser.parse("", "_BMD_Device_/Ramp/Ramp0");
QualifiedValue value = getAppContext().getTagManager().read(Arrays.asList(TagPathParser.parse("","_BMD_Device_/Ramp/Ramp0"))).get(0);
String x = value.getValue().toString();
JOptionPane.showMessageDialog(null, path.getItemName());

If this part of code is commented, the rest of program works fine.

What am I doing wrong? :cry:

Sry for noob questions…

Thanks in advance!


I see you got the dreaded ClassNotFoundException. It’s gotta be one of the most common Java exceptions there are. Thankfully, it’s relatively easy to fix. Basically, it’s saying you are referencing a class that has not been defined in any libraries included in your project (either in build time or in runtime - the runtime one got me once). To give you more specifics, tell me…are you using eclipse? Also, I’m not familiar with the “BirminD_PID_comp” class. Do you even need it for reading tags?