WFS GetFeature not working with propertyName

For the life of me, I cannot get propertyName=attribute to work in a WFS request. I can get the entire set of attributes, but not a subset. Geoserver 2.25.3

This works:

https://geo-ub.cei.psu.edu/geoserver/wfs?request=GetFeature&version=2.0.0&typeName=seabirds:species_geom&outputFormat=GML2&cql_filter=INTERSECTS(geom, POLYGON((18.818236213208863 -162.2278481012658, -4.833233504732476 -154.63291139240505,-2.7109418512729206 -122.43037974683546, 25.702448290251652 -127.44303797468355, 18.818236213208863 -162.2278481012658)))

this does not:

https://geo-ub.cei.psu.edu/geoserver/wfs?request=GetFeature&version=2.0.0&typeName=seabirds:species_geom&propertyName=species_id&outputFormat=GML2&cql_filter=INTERSECTS(geom, POLYGON((18.818236213208863 -162.2278481012658, -4.833233504732476 -154.63291139240505,-2.7109418512729206 -122.43037974683546, 25.702448290251652 -127.44303797468355, 18.818236213208863 -162.2278481012658)))

returns:

ows:ExceptionText
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Collection (java.lang.String and java.util.Collection are in module java.base of loader ‘bootstrap’) class java.lang.String cannot be cast to class java.util.Collection (java.lang.String and java.util.Collection are in module java.base of loader ‘bootstrap’)
</ows:ExceptionText>

Any thoughts?

Thanks,

Steve

I think, you should add service=WFS to your request.
See: Jira
Unable to use propertyName to filter properties in a GetFeature request when service is not set

1 Like

Thanks for the solution Stefan. I see this was fixed in the OP’s very next release: 2.25.4

As always, please upgrade to a supported version of GeoServer, both for feature fixes, as well as from a security perspective.

Peter

Peter and Stefan,

Thanks, that did the trick.

Cheers,
Steve