Event Custom connector - Test connector fails-failed to run 3PC java.lang.ClassCastException

lakshmin
Giga Guru

HI experts

We have developed a custom connector to get events from Polycom

The connector is working fine and creates events . But the Test connector and Midserver agent logs always log this error  whether its running from Test connector or using the event collection scheduled run- Events are always created despite this error- Can this error be ignored as we are getting events - Im not sure of this cast exception - the response from polycom is XML and im converting to javascript object using oob mid scriptinclude new XMLHelper .using this javascript object to get the final data and i have .tostring() when parsing raw input.

Test Connection results

Starting connector test for: Polycom events

Added test connection ECC probe

Monitoring results from connector

Connection test failed: failed to run 3PC java.lang.ClassCastException: org.mozilla.javascript.Undefined cannot be cast to org.mozilla.javascript.NativeObject

When i use the back ground scripts and try below - no error and it creates always the events

var jpr = new JavascriptProbe('My midserver');
jpr.setName("testPolyProbe");
jpr.setJavascript("var req = new Polycomconnector_JS(); req.Execute();");
jpr.addParameter("skip_sensor", true);
jpr.create();

Midserver logs

*** Script: Polycom integration created 2 events
07/08/20 06:56:36 (508) Worker-Interactive:ConnectorProbe-30a5dabe1b3d905890f3964c0a4bcb2b Slow execution (1016ms) of script: probe:Polycomconnector_JS
07/08/20 06:56:36 (508) Worker-Interactive:ConnectorProbe-30a5dabe1b3d905890f3964c0a4bcb2b SEVERE *** ERROR *** failed to run 3PC java.lang.ClassCastException: org.mozilla.javascript.Undefined cannot be cast to org.mozilla.javascript.NativeObject
07/08/20 06:56:36 (508) Worker-Interactive:ConnectorProbe-30a5dabe1b3d905890f3964c0a4bcb2b Status: null
07/08/20 06:56:36 (510) Worker-Interactive:ConnectorProbe-30a5dabe1b3d905890f3964c0a4bcb2b Enqueuing: C:\SNOW - Evnt Mgmt MID Server - TEST\agent\work\monitors\ECCSender\output_0\ecc_queue.30a5dabe1b3d905890f3964c0a4bcb2b.xml
07/08/20 06:56:36 (513) Worker-Interactive:ConnectorProbe-30a5dabe1b3d905890f3964c0a4bcb2b Worker completed: ConnectorProbe source: Polycom events time: 0:00:02.750

 

Thanks

Lakshmi

1 REPLY 1

rcz
Giga Contributor

This is usually caused when trying to access properties on an undefined object:

var wannabeObject = undefined;
var test = wannabeObject.someMember;