[...]
> Yikes, I don't like the sound of that. Is that with 8-SNAPSHOT ?
yep
> I tested the Quickstart a few hours ago when answering a question on
> the users' list and it was fine. Checking svn, nothing has changed in
> swing, main, render or docs since... Yep - just ran app again with no
> problems (apart from those pesky filter function name clash warnings).
>
> So, it must be YOUR problem :)
Hmpf, why did it smell like that? :)
But I can't see what the problem is.
I mean, it is no rocket science, it is pure copy/past science.
Add the deps to the pom:
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-swing</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>${project.version}</version>
</dependency>
paste the following in a class as quickstart suggests:
---------------------------------------------
// display a data store file chooser dialog for shapefiles
File file = JFileDataStoreChooser.showOpenFile("shp", null);
if (file == null) {
return;
}
FileDataStore store = FileDataStoreFinder.getDataStore(file);
SimpleFeatureSource featureSource = store.getFeatureSource();
// Create a map content and add our shapefile to it
MapContent map = new MapContent();
map.setTitle("Quickstart");
Style style = SLD.createSimpleStyle(featureSource.getSchema());
Layer layer = new FeatureLayer(featureSource, style);
map.addLayer(layer);
// Now display the map
JMapFrame.showMap(map);
---------------------------------------------
If I run this, I get the exception. This is really annoing...
I also tried to run the class with mvn exec:java to see if it is eclipse.
I only can think of some jvm setting? No clue...
Andrea
>
> Michael
>
>>
>> Else I will be happy to send you my zipped hello world module to run.
>>
>> Thanks,
>> Andrea
>>
>>
>>>
>>> Michael
>>>
>>> On 15 August 2011 20:13, andrea antonello <[email protected]>
>>> wrote:
>>>> Hi Michael
>>>>
>>>>> I'm sure this is just stating the obvious, but it looks like a
>>>>> services registry problem. It's trying to find "LengthFunction" which
>>>>> is sitting there in gt-main (org.geotools.filter.LengthFunction) but
>>>>> must not be in the
>>>>> META-INF/services/org.opengis.filter.expression.Function file that
>>>>> your app is seeing.
>>>>>
>>>>> I don't do eclipse, as you know, but I'm guessing there is some
>>>>> incantation missing in your RCP setup.
>>>>
>>>> based on our discussion about removing any datatype dependency from
>>>> the swt module, I created a small module just to run the swt module. I
>>>> added the data deps and let maven do its thing.
>>>>
>>>> Funny thing is that now I have the same
>>>>
>>>> java.lang.AbstractMethodError
>>>> at
>>>> org.geotools.filter.function.DefaultFunctionFactory.getFunctionName(DefaultFunctionFactory.java:106)
>>>> at
>>>> org.geotools.filter.function.DefaultFunctionFactory.loadFunctions(DefaultFunctionFactory.java:134)
>>>> ...
>>>>
>>>> also from within the module created a la Quickstart. No eclipse
>>>> involved. So I can only guess i am doing something strange.
>>>>
>>>> Any further idea?
>>>>
>>>> Andrea
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>
>>>>> Michael
>>>>>
>>>>>
>>>>> On 15 August 2011 17:51, andrea antonello <[email protected]>
>>>>> wrote:
>>>>>> I am facing a problem when reading a shapefile.
>>>>>>
>>>>>> Inside the gt-swt module reading a shapefile with:
>>>>>>
>>>>>> ShapefileDataStore store = new
>>>>>> ShapefileDataStore(shapeFile.toURI().toURL());
>>>>>> SimpleFeatureSource featureSource = store.getFeatureSource();
>>>>>>
>>>>>> works as it should, while when using the module as a library from an
>>>>>> rcp environment, using the same code, I get an error I can't trace
>>>>>> properly when calling store.getFeatureSource():
>>>>>>
>>>>>> java.lang.AbstractMethodError
>>>>>> at
>>>>>> org.geotools.filter.function.DefaultFunctionFactory.getFunctionName(DefaultFunctionFactory.java:106)
>>>>>> at
>>>>>> org.geotools.filter.function.DefaultFunctionFactory.loadFunctions(DefaultFunctionFactory.java:134)
>>>>>> at
>>>>>> org.geotools.filter.function.DefaultFunctionFactory.functionCache(DefaultFunctionFactory.java:97)
>>>>>> at
>>>>>> org.geotools.filter.function.DefaultFunctionFactory.getFunctionNames(DefaultFunctionFactory.java:58)
>>>>>> at
>>>>>> org.geotools.filter.FunctionFinder.lookupFunctions(FunctionFinder.java:181)
>>>>>> at
>>>>>> org.geotools.filter.FunctionFinder.findFunctionInternal(FunctionFinder.java:154)
>>>>>> at
>>>>>> org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:128)
>>>>>> at
>>>>>> org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:111)
>>>>>> at
>>>>>> org.geotools.filter.FilterFactoryImpl.function(FilterFactoryImpl.java:687)
>>>>>> at
>>>>>> org.geotools.feature.AttributeTypeBuilder.lengthRestriction(AttributeTypeBuilder.java:625)
>>>>>> at
>>>>>> org.geotools.feature.AttributeTypeBuilder.buildType(AttributeTypeBuilder.java:456)
>>>>>> at
>>>>>> org.geotools.feature.AttributeTypeBuilder.buildDescriptor(AttributeTypeBuilder.java:517)
>>>>>> at
>>>>>> org.geotools.data.shapefile.ShapefileDataStore.readAttributes(ShapefileDataStore.java:841)
>>>>>> at
>>>>>> org.geotools.data.shapefile.ShapefileDataStore.getSchema(ShapefileDataStore.java:742)
>>>>>> at
>>>>>> org.geotools.data.AbstractFileDataStore.getFeatureSource(AbstractFileDataStore.java:76)
>>>>>> ....
>>>>>>
>>>>>> Does anyone have an idea about what I am missing?
>>>>>>
>>>>>> Cheers,
>>>>>> Andrea
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> uberSVN's rich system and user administration capabilities and model
>>>>>> configuration take the hassle out of deploying and managing Subversion
>>>>>> and
>>>>>> the tools developers use with it. Learn more about uberSVN and get a free
>>>>>> download at: http://p.sf.net/sfu/wandisco-dev2dev
>>>>>> _______________________________________________
>>>>>> Geotools-gt2-users mailing list
>>>>>> [email protected]
>>>>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>>>>
>>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users