Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I recently found an issue with Geotools and getting the datastore for a shapefile.

If I try:

FileDataStore dataStore = FileDataStoreFinder.getDataStore(file);


Map connect = new HashMap();
connect.put("url", file.toURL());

DataStore dataStore = DataStoreFinder.getDataStore(connect);

getDataStore() always returns null. But using:

ShapefileDataStore dataStore = new ShapefileDataStore(file.toURI().toURL());

then the dataStore is set to the shapefile. Anyone have any ideas why this is? Is this a bug with Geootools 8.2? I'm running Geotools on Tomcat 7, perhaps there is some issue with Tomcat and the DataStore and FileDataStore classes?


share|improve this question
can you add what file actually contains? I suspect either it doesn't end .shp or it contains spaces and is not being encoded correctly –  iant Sep 24 '12 at 8:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.