Either there is a small bug associated with a very specific combination of inheritance and message handlers, or I've missed some implementation details that causes unexpected (to me) errors.
Details:
- I have two projects,
Parent
andChild
. Child
inherits fromParent
.Child
has a gateway message handler calledzTestMessage
.zTestMessage
takes a payload value ofprop
and logs it to the gateway log usingsystem.util.getLogger('zTestMessage').info(str(payload['prop']))
Parent
has a vision windows with a button that callszTestMessage
.Child
inherits this window. The inherited vision window is opened in a session ofchild
and the button is pushed.zTestMessage
appears to run. The logs show up on the gateway webpage as expected.- This error appears in the vision client diagnostic console.
09:38:24.894 [AWT-EventQueue-0] ERROR com.inductiveautomation.factorypmi.application.script.ScriptMessageReceiver - Client script MessageHandlerException, message handler 'zTestMessage'
com.inductiveautomation.ignition.common.script.message.MessageHandlerException: The message handler "zTestMessage" could not be found! Check your event script message handlers.
at com.inductiveautomation.ignition.common.script.message.MessageHandlerManager.processRequest(MessageHandlerManager.java:195)
at com.inductiveautomation.ignition.common.script.message.MessageHandlerManager.processMessage(MessageHandlerManager.java:144)
at com.inductiveautomation.factorypmi.application.script.ScriptMessageReceiver.receive(ScriptMessageReceiver.java:44)
at com.inductiveautomation.ignition.client.gateway_interface.FilteredPushNotificationListener$1.run(FilteredPushNotificationListener.java:39)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
There's another project, Daughter
.
Daughter
also inherits the vision window from Parent
.
When Daughter
is opened in a vision client and the button pushed,
- Logging occurs as expected.
- No error is thrown in the vision client diagnostic logs.
There seems to be some quirky interaction between inheritance and message handling here, unless I'm missing something.
I admit that the setup itself is odd. I encountered this while developing a project. Eventually I expect there to be many Daughter
projects using this message handler. I don't expect to actually launch Child
, so I shouldn't actually see the issue once all of the projects are created. I was using Child
to test the message handler before moving on and spent longer than I care to admit trying to figure out why The message handler "zTestMessage" could not be found!
.
Ignition 8.1.17
Support ticket: #140852