Spatial Queries quit working on ArcGIS Enterprise Server on Windows Server 2008

1564
9
04-04-2011 07:59 AM
S_Ector
New Contributor
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.
0 Kudos
9 Replies
HemingZhu
Occasional Contributor III
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...
0 Kudos
S_Ector
New Contributor
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
0 Kudos
HemingZhu
Occasional Contributor III
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


Have you check to see if your ArcGISWebSerivces acount has the access of your services directory folder? Usually in C:\Inetpub\wwwroot\ArcGIS\rest. This is the acount that access your services or cache through web...
0 Kudos
S_Ector
New Contributor
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:
0 Kudos
HemingZhu
Occasional Contributor III
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>
0 Kudos
S_Ector
New Contributor
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.
0 Kudos
S_Ector
New Contributor
I'm not sure if this helps, but here is a screenshot of the request that is failing.
0 Kudos
HemingZhu
Occasional Contributor III
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.


Try to use a very simple geometry like a extent (rectangle) to do you spatial query. Doing this you by pass the proxy POST to see if it works.  From what you described and the message,  it seems to me that either query request is not parsed correctly to the server or it do not parsed at all (more like the last). There is related post that might help you: http://forums.arcgis.com/threads/12690-Unable-to-load-proxy
0 Kudos
S_Ector
New Contributor
I just fround the problem from reading this thread: http://forums.arcgis.com/threads/27686-Trouble-with-buffer-query-not-returning-results

I was not running the web page from the web server directory.  After moving it there, I am now getting the results back! 

hzhu, thanks for your help!
0 Kudos