Creating Map object causes an error: "TypeError: this.spatialReference is undefined"

05-22-2019 08:41 AM
New Contributor

I am using ArcGIS for JavaScript v.3.28 served on WebSphere Application Server 9 and supported by Apache Struts 1.  My issue seems to stem from the loading of the Map object.  On loading the Map object, the browser will fail to complete loading the map and will add an error message to the console.  The error message is:

  • In Firefox 67.0:  TypeError: this.spatialReference is undefined
  • In Chrome 74.0.3729.169:  Uncaught TypeError: Cannot read property '_getInfo' of undefined
  • In Internet Explorer 11.1087.16299.0:  Unable to get property '_getInfo' of undefined or null reference

Among the files uploaded, you will see the mapping.jsp file loads run.js and the main.js will run.  In the main.js file, you will find two sections, "Scenario A" and "Scenario B" preceeding the "Standard Code" section.  "Scenario A" represents the simplest code needed to load a Map object; "Scenario B" represents the minimal amount of code necessary to load only a Map object with the configuration that is loaded in the "Standard Code".  "Scenario A", "Scenario B" and "Standard Code" sections are mtutally exclusive and if one section is uncommented, the other two are commented out and not executed.  ("Scenario A" and "Scenario B" exist solely for troubleshooting and will be removed before promtion to production.)

Regardless of the code configuration, if "Scenario A", "Scenario B" or "Standard Code" sections are executed, the result is the same:  the appropriate error message for that platform is added to the console and further execution of the Javascript halts.  The first time that the browser window is re-sized after the page loading stops results in another identical error message being added to the console.  If an error is thrown in Javascript, standard error capturing and management (try/catch) is not handling it.  Per the "Standard Code" scenario, I know from debugging statements that the page is executed once, then the "dojo.ready(init)" call is executed, then the "init()" call is executed and then execution simply stops, with no callbacks tied the asynchronous calls via dojo.on functionality executing.

If anyone is interested in seeing the other files that are loaded, those can be added but, honestly, I don't think those functionalities even enter into the picture.  I see other questions asked here along the same lines (see below) but no replies so. . .I hope this is different.

(The code has been lightly redacted to protect internal assets.)

20190610 Update:  This issue was misidentified.  The cause for some of this bad behavior was an issue with an networking element called Incapsula being improperly configured.  The remaining failures appear to be related to the application believing it has a valid token when it does not.  The spatialReference issue appears to be unrelated to both causes.

0 Kudos
0 Replies