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

Discussion created by softwavegis on Apr 4, 2011
Latest reply on Apr 8, 2011 by softwavegis
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.