I have ArcGIS Server Enterprise with ArcSDE/PostgreSQL running on one windows XP machine. All queries, including spatial queries are working as expected. Then I moved the data and maps to another installation of ArcGIS Server Enterprise on Windows 2008 Server 64bit with ArcSDE/PostgreSQL on a separate Windows 2008 Server 64bit. I can re-run the javascript against the new installation and all of the spatial queries return an error:
TypeError: _297 is null
(undefined="null", undefined="[object Object]")arcgis?v=2.2 (line 48)
(undefined="null")arcgis?v=2.2 (line 14)
_144()arcgis?v=2.2 (line 14)
_142(undefined="null")arcgis?v=2.2 (line 14)
(undefined="null")arcgis?v=2.2 (line 14)
_144()arcgis?v=2.2 (line 14)
_142(undefined="[object Object]")arcgis?v=2.2 (line 14)
[Break On This Error]
If I comment out the code that includes the spatial query, the data is returned just fine. Here is the code where I am having problems. The query results are never returned and the inline function does not get executed:
pquery.returnGeometry = false;
pquery.outFields = ["*"];
pquery.geometry = geometry;
pquery.spatialRelationship = query.SPATIAL_REL_CONTAINS;
pquery.where = "length (huc_id) = 8";
hucCtrFeatureLayer.selectFeatures(pquery, esri.layers.FeatureLayer.SELECTION_NEW, function (features) {
if (features.length > 0) {
dojo.byId("messages").innerHTML = "HUC 8 Features found: " + features.length;
} else {
dojo.byId("messages").innerHTML = "No HUC 8 features found.";
}
}, displayErr);
If I comment out these 2 lines, the query works just fine:
pquery.geometry = geometry;
pquery.spatialRelationship = query.SPATIAL_REL_CONTAINS;
This same error is occurring for all spatial queries regardless of the layers. I checked for spatial indexing and the layers being queried are showing they have a spatial index.
Any ideas? Thanks.
have you add your new services directory to your proxy.config. When you do a spatial query, it usually involved geometry-huge querysting!. That means that most likely your query have to go throug POST not GET...
I've been wondering about that, too since I can run the query using the REST query form. But, still no luck figuring it out.
Here is my proxy.config file.
<?xml version="1.0" encoding="utf-8" ?>
<!-- Proxy config is used to set the ArcGIS Server services that the proxy will forward to.
mustMatch: true to only proxy to sites listed, false to proxy to any site -->
<ProxyConfig mustMatch="true">
<serverUrls>
<!-- serverUrl options:
url = location of the ArcGIS Server, either specific URL or stem
matchAll = true to forward any request beginning with the url
token = (optional) token to include for secured service
dynamicToken = if true, gets token dynamically with username and
password stored in web.config file's appSettings section.
-->
<serverUrl url="http://myhost.com/arcgis/rest/services/"
matchAll="true"></serverUrl>
</serverUrls>
</ProxyConfig>
I can access the map layer query service by this url (host name is changed):
http://myhost.com/proxy/proxy.ashx?http://myhost.com/ArcGIS/rest/services/test/huc_centerpts/MapServ...
Looking at the NET traffic, it appears this is what is being requested, but I am seeing this error:
Error: Unable to load http://myhost.com/proxy/proxy.ashx?http://myhost.com/ArcGIS/rest/services/test/huc_centerpts/MapServ... status:0
I checked the folder C:\Inetpub\wwwroot\ArcGIS\rest and did not see the arcgiswebservices user listed in the permissions, so I went ahead and added it. Unfortunately, I am still getting the same error!
I am also seeing this error under the XML tab of the request (in firebug NET tab):
XML Parsing Error: no element found Location: moz-nullprincipal:{a3df32b9-85a8-4045-8239-c16f41c90f1c} Line Number 1, Column 1:
Do you include this script tag in your page?
<script type="text/javascript"> var djConfig = { parseOnLoad: true };</script>
Yes, it is there. This same code runs on my windows xp machine that has arcgis server enterprise and postgresql installed. Thanks for asking. I am hoping you'll think of something for me to check that finds the problem!
I walked through the setup of the proxy code again yesterday. I had forgotten to set up the proxy folder as an application on the windows server 2008 machine. I did that step yesterday morning, but it did not fix the issue.