AnsweredAssumed Answered

'dojo' is undefined

Question asked by jbailey.spatialbridge on Feb 14, 2013
Latest reply on Mar 7, 2013 by jbailey.spatialbridge
Hello,

Having a problem configuring the ArcGIS Server Javascript API. I've downloaded v3.3 from Esri.com, and followed the installation instructions. Since the target server does not have Internet access, I've changed the configuration to point to the Javascript API that I installed on the local server, following the directions in the REST API SDK help.

I've set up several services that are running, and I can view them in ArcMap and in ArcCatalog. However, when trying to view the services from ArcGIS Manager, the map does not appear, and the error ''dojo' is undefined' is thrown.

I think that the problem might be with how the URLs are being constructed in the output. Here are the contents of the rest-config.properties file that I modified according to the REST API SDK instructions:

#The log level of the application #possible values: SEVERE,WARNING,INFO,CONFIG,FINE,FINER,FINEST,OFF,ALL logLevel=SEVERE #enable/disable console logging consoleLogging=false #Collection of allowed cross-domain origins, If this property is not specified, it will default to allowing access to all domains allowedOrigins=* #Client App properties #JS API URLs jsapi.arcgis=http://172.10.1.41/arcgis_js_api/library/3.3/jsapi #jsapi.arcgis.sdk=http://help.arcgis.com/en/webapi/javascript/arcgis/ jsapi.arcgis.css=http://172.10.1.41/arcgis_js_api/library/3.3/jsapi/js/dojo/dijit/themes/tundra/tundra.css  #ArcGIS.com URLs arcgis.com.map=http://www.arcgis.com/home/webmap/viewer.html arcgis.com.map.text=ArcGIS.com Map


but looking at the HTML output when I try to preview the Sample World Cities, the URLs have changed:

[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>ArcGIS JavaScript API: SampleWorldCities</title>
<style type="text/css"> @import "http://172.10.1.41/jsapi/arcgis/3.3/js/dojo/dijit/themes/tundra/tundra.css";
@import "/arcgis/rest/static/jsapi.css";
</style> <script type="text/javascript"> var djConfig = { parseOnLoad: true };
</script> <script type="text/javascript" src="http://172.10.1.41/jsapi/arcgis/?v=3.3"> </script> <script type="text/javascript"> dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
var map;
function init() {
    map = new esri.Map("map");
          var layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/SampleWorldCities/MapServer");
          map.addLayer(layer);
    var resizeTimer;
    dojo.connect(map, 'onLoad', function(theMap) {
      dojo.connect(dijit.byId('map'), 'resize', function() {
        clearTimeout(resizeTimer);
        resizeTimer = setTimeout(function() {
          map.resize();
          map.reposition();
         }, 500);
       });
     });
    }
dojo.addOnLoad(init);
</script> </head> <body class="tundra"> <div dojotype="dijit.layout.BorderContainer" design="headline" gutters="true" style="width: 100%; height: 100%; margin: 0;"> <div dojotype="dijit.layout.ContentPane" region="top" id="navtable"> <div style="float:left;" id="breadcrumbs">ArcGIS JavaScript API: SampleWorldCities</div> <div style="float:right;" id="help">
Built using the <a href="http://help.arcgis.com/en/webapi/javascript/arcgis/">ArcGIS JavaScript API</a>
</div> </div> <div id="map" dojotype="dijit.layout.ContentPane" region="center"> </div> </div> </body>
</html>
[/HTML]

Any ideas on what I should look at to fix my configuration?

Thanks,

Jon.

Outcomes