Dojo Loader error

25299
18
01-11-2013 11:09 AM
NigelAlford
Occasional Contributor
I'm getting a Dojo Loader error on the ArcGIS js sheet and I can't determine if its myside or ESRI's side causing it. I'm calling ESRI and Jquery in the same HTML page (ESRI/Dojo in the header along with its designated js sheet, seperated to help with any weirdness...) and the Jquery is loaded at the end of the body with its own JS sheet. I'm using Jquery for other functionality pieces and not any map usage.
Everything has been running flawlessly for a few weeks until about 2 hours ago my map won't load and I'm getting this error:

Error {src: "dojoLoader", info: Array[2]}


and this:

GET http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/jquery.js 404 (Not Found) 


that sheet doesn't exist in 3.3 or 3.2 and I'm not calling that link anywhere in my code
18 Replies
JeffJacobson
Frequent Contributor
Based on the error message it looks like you are trying to load "jquery" as a module. As far as I know there is no "jquery" module built in to the ArcGIS JavaScript API.
0 Kudos
JacksonGilman1
Occasional Contributor
Check your dojoConfig...

var dojoConfig = {
  // ... your stuff
  packages: [
    {'jquery': 'path/to/your/jquery.js'}
  ]
}


Although...that is odd that everything broke suddenly as you say.  You don't have anything like this in there do you:

require(['jquery', 'esri/map'], function($, map) {
 // code... 
});


Good luck!
0 Kudos
NigelAlford
Occasional Contributor
@rivercityGIS

Here's my requires:
dojo.require("esri.map");
dojo.require("esri.toolbars.navigation");
dojo.require("esri.virtualearth.VETiledLayer");
dojo.require("dijit.form.Button");
dojo.require("dijit.Toolbar");
dojo.require("esri.layers.WebTiledLayer");


I'm combing through my code now, I'm thinking something is mixed somewhere thanks for your suggestion I'm calling a  web tilled layer:
new esri.layers.WebTiledLayer("http://${subDomain}.tile2.opencyclemap.org/transport/${level}/${col}/${row}.png", {
        id: "ocmTransport",
        subDomains: ["a", "b", "c"],
        copyright: '© OpenStreetMap contributors'
    });

I'm going to remove it and determine if the '$' is throwing ESRI off
0 Kudos
NigelAlford
Occasional Contributor
* the Tiled Layer didn't effect anything but my first error message line message is: "multipleDefine"
Error {src: "dojoLoader", info: Object}


url: "http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/nls/jsapi_en-us.js"


I'm still digging through the error message, but this may jog something for someone...I'm clearly defining something twice I need to determine what it is
0 Kudos
KubaSzostak1
Regular Contributor

I got the same error and map was not loaded.

For me switching to dojo debug mode make my app working.

<script>

  var dojoConfig = { isDebug: true };

</script>

<link rel="stylesheet" href="https://community.esri.com//js.arcgis.com/3.13/esri/css/esri.css">

<script src="http://js.arcgis.com/3.13/"></script>

dojoLoader error still exists but my map is loaded.

Maby this heps somebody.

Good loock!

Kuba

0 Kudos
KubaSzostak1
Regular Contributor

For esri folks: sample on esri website causes the same multipleDefine problem:

http://developers.arcgis.com/javascript/samples/framework_jquery/ 

0 Kudos
KubaSzostak1
Regular Contributor

I give up! Tell me what's wrong with  this code:

<!DOCTYPE html>

<html>

<head>

  <title>Create a Map</title>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">

  <link rel="stylesheet" href="http://js.arcgis.com/3.13/dijit/themes/claro/claro.css">

  <link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">

  <style>

    html, body, #mapDiv {   padding: 0;   margin: 0;   height: 100%;   }

  </style>

  <script src="http://js.arcgis.com/3.13/"></script>

  <script>

    var map;

    //require(["esri/map", "dojo/domReady!"], function(Map) {

    //  map = new Map("mapDiv", {

    //    center: [-56.049, 38.485],

    //    zoom: 3,

    //    basemap: "streets"

    //  });

    //});

  </script>

  <script>

  define([  "require",   "exports",

  "dojo/ready",   "dojo/on",  "dojo/dom-construct",

  "esri/config",  "esri/map",  "esri/graphic",   "esri/symbols/PictureMarkerSymbol",

  "esri/layers/WMSLayer",   "esri/geometry/Extent",   "esri/geometry/Point",

  "esri/geometry/webMercatorUtils",   "esri/InfoTemplate",   "esri/dijit/InfoWindowLite"],

 

    function () {

      console.log("dojo initialized.");

    });

  </script>

</head>

<body class="claro">

  <div id="mapDiv"></div>

</body>

</html>

There is nothing but loading scripts and this code produces such output:

#$%&^

0 Kudos
KellyHutchins
Esri Frequent Contributor

Kuba Szostak​ in your example if you switch to require instead of define it works. Define is for defining a new module. In the example you provided require, which loads existing modules, will work.

If you want to define a new module take a look at the  Write a class help topic which shows how to create the module and load it into your app.

Revised version of your code:

<!DOCTYPE html>
<html>
<head>
  <title>Create a Map</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
  <link rel="stylesheet" href="http://js.arcgis.com/3.13/dijit/themes/claro/claro.css">
  <link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">
  <style>
    html, body, #mapDiv {   padding: 0;   margin: 0;   height: 100%;   }
  </style>


  <script src="http://js.arcgis.com/3.13/"></script>
  <script>
    var map;
    //require(["esri/map", "dojo/domReady!"], function(Map) {
    //  map = new Map("mapDiv", {
    //    center: [-56.049, 38.485],
    //    zoom: 3,
    //    basemap: "streets"
    //  });
    //});
  </script>

  <script>
  require([
  "dojo/ready",   "dojo/on",  "dojo/dom-construct",
  "esri/config",  "esri/map",  "esri/graphic",   "esri/symbols/PictureMarkerSymbol",
  "esri/layers/WMSLayer",   "esri/geometry/Extent",   "esri/geometry/Point",
  "esri/geometry/webMercatorUtils",   "esri/InfoTemplate",   "esri/dijit/InfoWindowLite"],

    function () {
      console.log("dojo initialized.");
    });
  </script>


</head>
<body class="claro">
  <div id="mapDiv"></div>
</body>
</html>
KubaSzostak1
Regular Contributor

Kelly you are my personal hero!

AMD style programming is new for me so I missed difference between define() and require(). They describing both as quite the same with one difference that define() should return value. But thanks to you Kelly now I know that define() is 'lazy' declaration and when you execute define() function nothing will happen. In order to load/run code require() is needed.

I'm writing my code in TypeScript using ArcGIS JavaScript API, jQuery and jQueryMobile (because of their Sidebar Panel). When I switched to AMD style coding and move my JS script to require() method all of console errors are gone! There is my code:

<!--jQuery Mobile CDN-->
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>

<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>

<!-- Non AMD/dojo MapViewer scripts-->
<script src="js-mapviewer/mapviewer-init.js"></script>

<!--ArcGIS CDN-->
<link rel="stylesheet" href="https://community.esri.com//js.arcgis.com/3.13/esri/css/esri.css">

<script  src="http://js.arcgis.com/3.13/"></script>

<!-- MapViewer script (depend on ArcGIS/dojo/AMD) -->
<script>
require(["js-mapviewer/mapviewer-app.js"], function (mapViewer) {
    console.log("MapViewer application loaded.");
  });
</script>
<!--This is error prone: <script src="js-mapviewer/mapviewer-app.js"></script> -->

Thank you Kelly!

Kuba