1

I am getting an error when I try to chain a GeoServer WPS subprocess in a gs:UnionFeatureCollection process.

<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  <ows:Identifier>gs:UnionFeatureCollection</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>first</ows:Identifier>
      <wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wps" method="POST">
        <wps:Body>
          <wps:Execute version="1.0.0" service="WPS">
            <ows:Identifier>gs:Query</ows:Identifier>
            <wps:DataInputs>
              <wps:Input>
                <ows:Identifier>features</ows:Identifier>
                <wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs" method="POST">
                  <wps:Body>
                    <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2" xmlns:topp="http://www.openplans.org/topp">
                      <wfs:Query typeName="topp:states"/>
                    </wfs:GetFeature>
                  </wps:Body>
                </wps:Reference>
              </wps:Input>
              <wps:Input>
                <ows:Identifier>filter</ows:Identifier>
                <wps:Data>
                  <wps:ComplexData mimeType="text/plain; subtype=cql"><![CDATA[contains("wkb_geometry",'POINT(-96.41 35.50)')]]></wps:ComplexData>
                </wps:Data>
              </wps:Input>
            </wps:DataInputs>
            <wps:ResponseForm>
              <wps:RawDataOutput mimeType="application/json">
                <ows:Identifier>result</ows:Identifier>
              </wps:RawDataOutput>
            </wps:ResponseForm>
          </wps:Execute>
        </wps:Body>
      </wps:Reference>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>second</ows:Identifier>
      <wps:Data>
<wps:ComplexData mimeType="application/json"><![CDATA[{"type":"FeatureCollection","features":[...]}]]></wps:ComplexData>
      </wps:Data>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:RawDataOutput mimeType="application/json">
      <ows:Identifier>result</ows:Identifier>
    </wps:RawDataOutput>
  </wps:ResponseForm>
</wps:Execute>

If I run this request (with some JSON in the CDATA block) I get a NullPointerException:

2016-04-13 14:29:53,393 INFO [geoserver.wps] - 
Request: getServiceInfo
2016-04-13 14:29:53,509 ERROR [wps.executor] - Process execution failed
org.geotools.process.ProcessException: java.lang.NullPointerException
    at org.geotools.process.factory.AnnotationDrivenProcessFactory$InvokeMethodProcess.execute(AnnotationDrivenProcessFactory.java:565)
    at org.geoserver.wps.executor.ProcessStartupFilter$ProcessStartupWrapper.execute(ProcessStartupFilter.java:51)
    at org.geoserver.wps.executor.DefaultProcessManager$ProcessCallable.call(DefaultProcessManager.java:201)
    at org.geoserver.wps.executor.DefaultProcessManager$ProcessCallable.call(DefaultProcessManager.java:169)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
    at org.geotools.process.vector.UnionFeatureCollection.execute(UnionFeatureCollection.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.geotools.process.factory.AnnotationDrivenProcessFactory$InvokeMethodProcess.execute(AnnotationDrivenProcessFactory.java:549)
    ... 7 more
2016-04-13 14:29:53,513 INFO [geoserver.wps] - 
Request: execute
    service = WPS
    version = 1.0.0
    baseUrl = http://localhost:4080/geoserver/
    identifier:
        value = gs:UnionFeatureCollection
    dataInputs:
        input[0]:
            identifier = net.opengis.ows11.impl.CodeTypeImpl@1bdca30 (value: first, codeSpace: null)
            reference = net.opengis.wps10.impl.InputReferenceTypeImpl@ea11c1 (body: net.opengis.wps10.impl.ExecuteTypeImpl@15f7579 (language: null, service: WPS, version: 1.0.0, baseUrl: null, extendedProperties: {}), encoding: null, href: http://geoserver/wps, method: POST, mimeType: text/xml, schema: null)input[0]:
            identifier = net.opengis.ows11.impl.CodeTypeImpl@1358603 (value: second, codeSpace: null)
            data = net.opengis.wps10.impl.DataTypeImpl@da231f
    responseForm:
        rawDataOutput:
            identifier = net.opengis.ows11.impl.CodeTypeImpl@ac5ddc (value: result, codeSpace: null)
            mimeType = application/json

If I run the subprocess and paste the output of that into the input block then I get the correct answer back.

Can anyone see what I'm missing?

1

It turns out that currently there is a bug in GeoTools that causes this issue when unioning filtered collections.

I have committed a fix into the master branch and will hopefully backport it to 14.x later this week.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.