On Tue, Nov 27, 2012 at 10:30 AM, Emmanuel Blondel <
[email protected]> wrote:

>  Hello all,
>
> Since a few weeks, i don't know why but the WFS Datastore does not work
> anymore in my codes.
> I'm using GeoTools 8.2.
>
> Here the sample code I run:
>
> *SimpleFeatureCollection result = null;**
> **        try{**
> **            **
> **            String wfsGetCap =
> "http://localhost:8080/geoserver/ows?service=WFS&version=1.0.0&request=GetCapabilities";<http://localhost:8080/geoserver/ows?service=WFS&version=1.0.0&request=GetCapabilities>
> ;**
> **            **
> **            // use the WFS Datastore**
> **            Map<String, Serializable> params = new HashMap<String,
> Serializable>();**
> **            params.put(WFSDataStoreFactory.URL.key, wfsGetCap);**
> **            params.put(WFSDataStoreFactory.TIMEOUT.key, new
> Integer(60000));**
> **            **
> **            DataStore datastore = DataStoreFinder.getDataStore(params);*
> *
> **            SimpleFeatureSource featureSource =
> datastore.getFeatureSource("mylayer");**
> **            **
> **            **
> **            result = featureSource.getFeatures();**
> **            **
> **        }catch(Exception e){**
> **            new RuntimeException("Unable to get the target collection",
> e);**
> **        }**
> **        **
> **System.out.println(result.size());*
>
>
> and the error i get:
>
> *Exception in thread "main" java.lang.NoSuchMethodError:
> org.geotools.filter.capability.FunctionNameImpl.parameter(Ljava/lang/String;Ljava/lang/Class;)Lorg/opengis/parameter/Parameter;
> **
> **    at
> org.geotools.filter.function.FilterFunction_setCRS.<clinit>(FilterFunction_setCRS.java:32)
> **
> ***
>

This is a classpath issue, jars from different versions of GeoTools have
been added in the classpath.
Are you using Maven?


> Could somebody help me in identifying what's the issue and solve it?
> In other case, does anyone know an efficient way to get feature
> collections from WFS (possibly applying a filter)?
>
>
Just add a filter in the query when grabbing the feature collection, the
store will try to send as much of it
as possible down to the WFS server, according to what the server advertises
as its filter capabilities

Cheers
Andrea
-- 
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to