Select to view content in your preferred language

Cannot invoke "com.esri.standardsql.query.Selection.getExpression()" because "<local6>.y" is null

2929
16
08-01-2024 07:39 AM
NoahFrazzini
Emerging Contributor

Following an upgrade from 11.1 to 11.3, our hosting server started throwing these errors.

Type: Severe

Message: "feature server..." Cannot invoke "com.esri.standardsql.query.Selection.getExpression()" because "<local6>.y" is null

Target: Rest

Machine: Hosting Server

Code: 9000 (Cannot access Admin API)

-- I am pulling these errors from the Admin API

Process: 11868. 

I am unsure as to why this has started so any advice or insight would be greatly appreciated. All enterprise datastores are healthy and validated. This specifically started happening following the upgrade and have not seen any other documentation on the matter. Due to privacy concerns I cannot provide screenshots.

16 Replies
jb4ward
New Contributor

I was getting the same error, not sure if this is a fix all, but mine came down to a spatial reference issue. My script was selecting points by a work order in one layer, then looking for matching point numbers in another and updating the location for the matching point.

When it hit the line for the query, the script would spit the 'error': {'code': 10500, 'description': 'Cannot invoke "com.esri.sde.sdk.pe.engine.PeLinunit.getUnitFactor()" because "<local6>" is null'}

I updated the script to compare the spatial references, if they don't match then reproject. Code still needs optimization and more error handling, but hopefully this helps.

from arcgis.gis import GIS
from arcgis.features import FeatureLayer
from arcgis.geometry import Geometry, SpatialReference, project

"""SET WORK ORDER ID FIRST"""
workOrderID = 'workorderid'
# Connect to ArcGIS Online
gis = GIS("https://yoururl.com/arcgis", "username", "password")

# Get layers

# These points are the Trimble Data
layer_a_item = gis.content.get("yourItemIDa")
# These points will be moved, Use Field Collection Layer
layer_b_item = gis.content.get("yourItemIDb")

layer_a = layer_a_item.layers[0]
layer_b = layer_b_item.layers[0]

# Define the field names for point numbers
point_number_field1 = "field1"
point_number_field2 = "point_name"

# Query all points in Layer A
query1 = "workOrderID = '{}'".format(workOrderID)

layer_a_features = layer_a.query(where='1=1', out_fields="*", return_geometry=True)


# Get spatial references safely
sr_layer_a = layer_a.properties.get('extent', {}).get('spatialReference', {}).get('wkid')

sr_layer_b = layer_b.properties.get('extent', {}).get('spatialReference', {}).get('wkid')

# Fallback for spatial reference
if not sr_layer_a:
    # sr_layer_a = layer_a.query(return_geometry=True).spatial_reference.wkid
    sr_layer_a = layer_a.query(return_geometry=True).spatial_reference
    print(sr_layer_a)
if not sr_layer_b:
    # sr_layer_b = layer_b.query(return_geometry=True).spatial_reference.wkid
    sr_layer_b = layer_b.query(return_geometry=True).spatial_reference

# Print spatial references for verification
print(f"Layer A Spatial Reference WKID: {sr_layer_a}")
print(f"Layer B Spatial Reference WKID: {sr_layer_b}")

# Ensure spatial reference objects
sr_layer_a = SpatialReference(sr_layer_a)
sr_layer_b = SpatialReference(sr_layer_b)

# Loop through each feature in Layer A
for feature_a in layer_a_features:
    try:
        point_number = feature_a.attributes.get(point_number_field1)
        location_a = feature_a.geometry
        
        if not point_number:
            print("Skipping feature without a valid point number.")
            continue
        
        # Validate geometry
        geometry_a = Geometry(location_a)
        if not geometry_a.is_valid:
            print(f"Invalid geometry for point number {point_number}. Skipping...")
            continue
        
        # Project geometry to match Layer B's spatial reference
        if sr_layer_a != sr_layer_b:
            geometry_a = project(geometries=[geometry_a], in_sr=sr_layer_a, out_sr=sr_layer_b)[0]
            print(f"Projected geometry for point number {point_number} to match Layer B's spatial reference.")
        
        # Explicitly set spatial reference
        geometry_a.spatialReference = sr_layer_b
        
        # Find matching feature in Layer B
        query2 = f"{query1} AND {point_number_field2} = '{point_number}'"
        layer_b_feature = layer_b.query(where=query2, out_fields="*", return_geometry=True).features
        
        if layer_b_feature:
            feature_b = layer_b_feature[0]
            feature_b.geometry = geometry_a  # Update geometry to match Layer A
            
            # Submit the update
            update_result = layer_b.edit_features(updates=[feature_b])
            if update_result['updateResults'][0]['success']:
                print(f"Successfully updated point number {point_number} in Layer B.")
            else:
                error_description = update_result['updateResults'][0].get('error', {}).get('description', 'Unknown error')
                print(f"Failed to update point number {point_number}. Error: {error_description}")
        else:
            print(f"No matching point found in Layer B for point number {point_number}.")
    
    except Exception as e:
        print(f"Error processing point number {point_number}: {e}")

print("Geometry update process completed.")

 

0 Kudos
JakeNeedle
Regular Contributor

Any solution for this?  It is still happening in 11.4.

0 Kudos
alexanderzitzmann
Emerging Contributor

same problem here by updating from 11.2 to 11.4:

/configuredatastore.sh https://********:6443/arcgis siteadmin ******* /gisdata/arcgisdatastore/ --stores spatiotemporal
Configuring data store(s). Initial configuration may take a few minutes. When configuring an upgraded data store, this process may take several hours depending on the size of your data. Please wait...

Performing upgrade prerequisite checks on data stores...

Error encountered: Cannot invoke "com.esri.arcgis.discovery.json.JSONArray.length()" because "<local3>" is null

i will open a case by esri tommorow

0 Kudos
JakeNeedle
Regular Contributor

Any luck with Tech Support?

0 Kudos
alexanderzitzmann
Emerging Contributor

Unfortunately not, but I was able to solve the problem myself. In the OpenSearch configuration, localhost was set as the hostname.
I corrected this in the following files:
-spatiotemporal-config.json
-opensearch.yml
I also had to create a server certificate for OpenSearch itself and replace the node.pem and node-key.pem files (opensearch doesn't like wildcard certs and the cert must be the same like the hostname).
(Instructions:
https://gist.github.com/cecilemuller/9492b848eb8fe46d462abeb26656c4f8 )
Import the cross-certificate on the Geoevent server, and then everything worked.

0 Kudos
Joshua-Young
Honored Contributor

Did you ever find a resolution to this? We are on 11.5 and the specific error you mentioned is still happening. So far we are only seeing it on hosted feature services.

"Not all those who wander are lost" ~ Tolkien
0 Kudos
Marc_Graham
Frequent Contributor

We narrowed it down to a web Mercator hosted feature service in a non-web Mercator scene. Try adding some services to a scene where the projections don’t match and see if you can trigger the error.

0 Kudos