ArcSDE spatial filters outside of layer bounds cause exceptions

Description

I've come across what might be a bug in the ArcSDE data source.

i'm running geoserver 1.2.0 on jakarta 5.0.27 on windows 2000, ArcSDE is
version 8.2

When i do a getfeature with a spatial filter where the spatial filter is in
the bounds of the target datasource such as:

http://beta.landgate.com.au/geoserver/wfs/GetFeature - http://beta.landgate.com.au/geoserver/wfs/GetFeature
<wfs:GetFeature service="WFS" version="1.0.0"
outputFormat="GML2"
xmlns:topp="http://www.openplans.org/topp"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns="http://www.opengis.net/ogc"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd - http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
<wfs:Query typeName="topp:SDE.W_PLANNING_MRSBDRY">
<ogc:Filter>
<ogc:Intersects>
<ogcropertyName>the_geom</ogcropertyName>
<gmloint srsName="http://www.opengis.net/gml/srs/epsg.xml#4326
">
<gml:coordinates>116.30,-31.80</gml:coordinates>
</gmloint>
</ogc:Intersects>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>

it works fine, however if i make a modification to the location of the
point so that it is outside of the extent of the dataset (say 126.30,
-31.80) i get a java error:

<?xml version="1.0" ?>
<ServiceExceptionReport
version="1.2.0"
xmlns="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/ogc
http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd - http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">
<ServiceException>
problem with FeatureResults: org.geotools.data.DataSourceException:
Encoder error Error building SeFilter
at
org.geotools.data.arcsde.ArcSDEAdapter.createSeQuery(ArcSDEAdapter.java:446)
at
org.geotools.data.arcsde.ArcSDEAdapter.createSeQuery(ArcSDEAdapter.java:363)
at
org.geotools.data.arcsde.ArcSDEDataStore.getCount(ArcSDEDataStore.java:476)
at
org.geotools.data.AbstractFeatureSource.getCount(AbstractFeatureSource.java:221)
at
org.geotools.data.DefaultFeatureResults.getCount(DefaultFeatureResults.java:196)
at
org.vfny.geoserver.responses.wfs.FeatureResponse.execute(FeatureResponse.java:285)
at
org.vfny.geoserver.responses.wfs.FeatureResponse.execute(FeatureResponse.java:142)
at
org.vfny.geoserver.servlets.AbstractService.doService(AbstractService.java:357)
at
org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:295)
at
org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.RuntimeException: Error building SeFilter
at
org.geotools.filter.GeometryEncoderSDE.visit(GeometryEncoderSDE.java:210)
at
org.geotools.filter.GeometryFilterImpl.accept(GeometryFilterImpl.java:353)
at
org.geotools.filter.GeometryEncoderSDE.encode(GeometryEncoderSDE.java:144)
at
org.geotools.data.arcsde.FilterSet.createSpatialFilters(ArcSDEAdapter.java:635)
at
org.geotools.data.arcsde.ArcSDEAdapter.createSeQuery(ArcSDEAdapter.java:424)
... 37 more
Caused by: java.lang.IllegalArgumentException: no geometry builder is
defined to construct class com.vividsolutions.jts.geom.GeometryCollection
instances.
at
org.geotools.data.arcsde.GeometryBuilder.builderFor(GeometryBuilder.java:391)
at
org.geotools.filter.GeometryEncoderSDE.addSpatialFilter(GeometryEncoderSDE.java:258)
at
org.geotools.filter.GeometryEncoderSDE.visit(GeometryEncoderSDE.java:186)
... 41 more
</ServiceException>
</ServiceExceptionReport>

doing a query to an area in the target dataset that has no feature but is
within the boundings works fine (i.e. a feature set with no features), you
only get this error when the filter request is outside the boundings of the
dataset. Altering the boundings in the WFS config has no effect, i'm
guessing SDE is returning an 'out of bounds' error that is choking
geoserver ? is this because its ArcSDE version 8.2 and not 8.3 ?

Cheers and well done on the excellent work !

-ivan

Ivan Price
Shared Land Services
Department of Land Information
Western Australia
Ivan.Price@dli.wa.gov.au

Environment

None

Activity

Show:
codehaus
April 10, 2015, 2:48 PM

CodeHaus Comment From: cholmes - Time: Thu, 19 Aug 2004 14:06:53 -0500
---------------------
This is committed on 2.0.x and head, just waiting for gabriel's coding approval. And attached fixed arcsde jar for geoserver (and geotools).

codehaus
April 10, 2015, 2:48 PM

CodeHaus Comment From: ivan - Time: Fri, 20 Aug 2004 02:37:42 -0500
---------------------
Hi there geoserver/tools crew,

Unfortunately we seem to have gone backwards. The fix causes the correct result to occur the first time, but then after the first use of the SDE layer all subsequent requests (including attribute filters and getfeature with no filter) fail. Also, after this has occurred the web admin tool can't edit/read the data featuretypes: ([ServletException in:/WEB-INF/pages/data/featureTypes/Editor.jsp] null' )

The first error reads:

2004-08-20 13:49:13 StandardWrapperValve[GetFeature]: Servlet.service() for servlet GetFeature threw exception

java.lang.IllegalStateException: getOutputStream() has already been called for this response

at org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:599)

at org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:163)

at org.vfny.geoserver.servlets.AbstractService.send(AbstractService.java:601)

at org.vfny.geoserver.servlets.AbstractService.sendError(AbstractService.java:654)

at org.vfny.geoserver.servlets.AbstractService.doService(AbstractService.java:435)

at org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:295)

at org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:249)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)

at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)

at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)

at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)

at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)

at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)

at java.lang.Thread.run(Thread.java:534)

and then after that every query gives: (including attribute non-spatial filters)

<?xml version="1.0" ?>

<ServiceExceptionReport

   version="1.2.0"

&nbsp;&nbsp;&nbsp;xmlns=&quot;<a href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>&quot;

&nbsp;&nbsp;&nbsp;xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&quot;

&nbsp;&nbsp;&nbsp;xsi:schemaLocation=&quot;<a href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a> <a href="http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd</a>&quot;&gt;

&nbsp;&nbsp;&nbsp;&lt;ServiceException&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;problem with FeatureResults: org.geotools.data.DataSourceException: Error querying the layers list

at org.geotools.data.arcsde.ArcSDEConnectionPool.getSdeLayer(ArcSDEConnectionPool.java:478)

at org.geotools.data.arcsde.ArcSDEAdapter.computeFilters(ArcSDEAdapter.java:469)

at org.geotools.data.arcsde.ArcSDEAdapter.createSeQuery(ArcSDEAdapter.java:408)

at org.geotools.data.arcsde.ArcSDEAdapter.createSeQuery(ArcSDEAdapter.java:363)

at org.geotools.data.arcsde.ArcSDEDataStore.getCount(ArcSDEDataStore.java:476)

at org.geotools.data.AbstractFeatureSource.getCount(AbstractFeatureSource.java:221)

at org.geotools.data.DefaultFeatureResults.getCount(DefaultFeatureResults.java:196)

at org.vfny.geoserver.responses.wfs.FeatureResponse.execute(FeatureResponse.java:285)

at org.vfny.geoserver.responses.wfs.FeatureResponse.execute(FeatureResponse.java:142)

at org.vfny.geoserver.servlets.AbstractService.doService(AbstractService.java:357)

at org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:295)

at org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:249)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)

at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)

at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)

at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)

at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)

at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)

at java.lang.Thread.run(Thread.java:534)

Caused by: com.esri.sde.sdk.client.SeException: NETWORK I/O OPERATION FAILED.

at com.esri.sde.sdk.client.SeExceptionFactory.a([DashoPro-V2.1-070100])

at com.esri.sde.sdk.client.SeExceptionFactory.a([DashoPro-V2.1-070100])

at com.esri.sde.sdk.client.SeConnection.getLayers([DashoPro-V2.1-070100])

at org.geotools.data.arcsde.ArcSDEConnectionPool.getSdeLayer(ArcSDEConnectionPool.java:476)

... 39 more

&nbsp;&nbsp;&nbsp;&lt;/ServiceException&gt;

&lt;/ServiceExceptionReport&gt;

also, after this has occurred the web admin tool can&#39;t edit/read the data featuretypes: ([ServletException in:/WEB-INF/pages/data/featureTypes/Editor.jsp] null&#39; )

so perhaps the sde interface is broken now ?

hope this helps, good luck ! sorry for not logging this on the jira on tues/wednesday chris, i was away from email the last couple of days. take it easy,

-ivan

codehaus
April 10, 2015, 2:48 PM

CodeHaus Comment From: ivan - Time: Fri, 20 Aug 2004 03:06:24 -0500
---------------------
Hi there again,

after a reboot and retest i can&#39;t seem to recreate my own problem, perhaps i had broken the dataset itself in the web admin tool and hence broken access to the data causing the errors ?

it seems to all be working perfectly now so please ignore my comment Created: Fri, 20 Aug 2004 2:37 AM.

Apologies for this, talk to you later.

-ivan

codehaus
April 10, 2015, 2:48 PM

CodeHaus Comment From: cholmes - Time: Fri, 20 Aug 2004 14:29:44 -0500
---------------------
Ah, I&#39;m glad it fixed itself, that looked like very scary stuff. Let me know if it pops up again, glad it got working. And no worries about not using jira, any bug report is good even if not on jira

codehaus
April 10, 2015, 2:48 PM

CodeHaus Comment From: cholmes - Time: Thu, 7 Oct 2004 17:01:00 -0500
---------------------
fixed

Assignee

Unassigned

Reporter

codehaus

Triage

None

Components

Fix versions

Affects versions

Priority

High
Configure