Select to view content in your preferred language

dojo is not defined in installing jsapi2.6 on tomcat

667
3
03-03-2012 09:16 PM
taopy
by
Deactivated User
i have copied ArcGIS JSAPI 2.6  to tomcat 6.0, and searched for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replaced this text with "localhost:8080/arcgis_js_api/library/2.6/arcgis/" of all the files.
but when i use the test code :
<!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"/>
  <title>Simple Map</title>
  <link rel="stylesheet" type="text/css" href="http://localhost:8080/arcgis_js_api/library/2.6/jsapi/js/dojo/dijit/themes/tundra/tundra.css"/>
  <script type="text/javascript" src="http://localhost:8080/arcgis_js_api/library/2.6/jsapi/"></script>
  <script type="text/javascript">
   dojo.require("esri.map");
   function init() {
    var myMap = new esri.Map("mapDiv");
    //note that if you do not have public Internet access then you will need to point this url to your own locally accesible cached service.
    var myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer");
    myMap.addLayer(myTiledMapServiceLayer);
   }

   dojo.addOnLoad(init);

  </script>
 </head>
 <body class="tundra">
  <div id="mapDiv" style="width:900px; height:600px; border:1px solid #000;"></div>
 </body>
</html>

it throw an error like this:"Uncaught SyntaxError: Unexpected identifier  , dojo is not defined".
but if i use the jdk 1.5  ,it not throw any error,
i means the error "dojo is not defined " only throwed in the environment of jdk 1.6.
so ,can you help me to solve the problem?
thx?
0 Kudos
3 Replies
derekswingley1
Deactivated User
What happens when you load http://localhost:8080/arcgis_js_api/library/2.6/jsapi/ in your browser?
0 Kudos
taopy
by
Deactivated User
What happens when you load http://localhost:8080/arcgis_js_api/library/2.6/jsapi/ in your browser?



when i load this url in chrome ,it responses a page with js like:
/*
 Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
 Available via Academic Free License >= 2.1 OR the modified BSD license.
 see: http://dojotoolkit.org/license for details
*/

/*
 This is an optimized version of Dojo, built for deployment and not for
 development. To get sources and documentation, please visit:

  http://dojotoolkit.org
*/

(function(){var _1=null;if((_1||(typeof djConfig!="undefined"&&djConfig.scopeMap))&&(typeof window!="undefined")){var _2="",_3="",_4="",_5={},_6={};_1=_1||djConfig.scopeMap;for(var i=0;i<_1.length;i++){var _7=_1;_2+="var "+_7[0]+" = {}; "+_7[1]+" = "+_7[0]+";"+_7[1]+"._scopeName = '"+_7[1]+"';";_3+=(i==0?"":",")+_7[0];_4+=(i==0?"":",")+_7[1];_5[_7[0]]=_7[1];_6[_7[1]]=_7[0];}eval(_2+"dojo._scopeArgs = ["+_4+"];");dojo._scopePrefixArgs=_3;dojo._scopePrefix="(function("+_3+"){";dojo._scopeSuffix="})("+_4+")";dojo._scopeMap=_5;dojo._scopeMapRev=_6;}(function(){if(typeof this["loadFirebugConsole"]=="function"){this["loadFirebugConsole"]();}else{this.console=this.console||{};var cn=["assert","count","debug","dir","dirxml","error","group","groupEnd","info","profile",........


when i load this url in ie8 ,it responses a dialog to confirm to download the jsapi.js file.
0 Kudos
derekswingley1
Deactivated User
It sounds like you're referencing the API correctly then. Can you open a ticket with support? They're better with server configuration issues like this.
0 Kudos