[geotk] Sample application

johann.sorel at geomatys.com johann.sorel at geomatys.com
Sat Aug 4 04:12:32 PDT 2012


Hello,

The demo has been written for the latest Geotoolkit version (download it 
here) :
http://jenkins.geotoolkit.org
http://jenkins.geotoolkit.org/job/Geotoolkit-pending/lastSuccessfulBuild/artifact/target/bundles/geotk-shell.zip

The ShpFilesLocker class which is causing problems in your case was 
replaced in december 2011.
Version 3.19 does not contain this fix unfortunatly, you will have to 
use the 3.x-SNAPSHOT version until our next release.



Johann Sorel
Geomatys




On 03/08/2012 20:30, Doug Kunzman wrote:
> I'm trying to use the Geotoolkit 3.19 with Java 1.6 x64 to create a 
> shapefile on Windows 7 PC.
> After considerable frustration I executed the sample and am getting a 
> similar error that I'm getting in my code.
>
> Does anyone have any ideas what could be wrong?
>
> The error is as follows,
> ug 3, 2012 2:24:25 PM 
> org.geotoolkit.referencing.factory.epsg.ThreadedEpsgFactory 
> createBackingStore
> INFO: Connected to EPSG database 
> "jdbc:hsqldb:C:\Users\dkunzman\Application 
> Data\Geotoolkit.org\EPSG\HSQL/7.09" on "HSQL Database Engine".
> Aug 3, 2012 2:24:25 PM org.geotoolkit.data.shapefile.StorageFile 
> replaceOriginals
> SEVERE: Unable to delete the file: \tmp\test.shx when attempting to 
> replace with temporary copy.
> Aug 3, 2012 2:24:25 PM org.geotoolkit.data.shapefile.StorageFile 
> replaceOriginals
> SEVERE: The problem is almost certainly caused by the fact that there 
> are still locks being held on the shapefiles.  Probably a reader or 
> writer was left unclosed
> Aug 3, 2012 2:24:25 PM org.geotoolkit.data.shapefile.ShpFiles 
> logCurrentLockers
> SEVERE: The following locker still has a lock? write on 
> file:/tmp/test.shp by StorageFile: test5109458120423620803.shp
>  it was created with the following stack trace
> org.geotoolkit.data.shapefile.ShpFilesLocker$Trace: Locking
> at 
> org.geotoolkit.data.shapefile.ShpFilesLocker.setTraceException(_ShpFilesLocker.java:50_) 
>
> at 
> org.geotoolkit.data.shapefile.ShpFilesLocker.<init>(_ShpFilesLocker.java:45_) 
>
> at 
> org.geotoolkit.data.shapefile.ShpFiles.acquireWrite(_ShpFiles.java:468_)
> at 
> org.geotoolkit.data.shapefile.StorageFile.getSrcURLForWrite(_StorageFile.java:167_) 
>
> at 
> org.geotoolkit.data.shapefile.StorageFile.replaceOriginals(_StorageFile.java:103_) 
>
> at 
> org.geotoolkit.data.shapefile.ShapefileFeatureWriter.clean(_ShapefileFeatureWriter.java:204_) 
>
> at 
> org.geotoolkit.data.shapefile.ShapefileFeatureWriter.close(_ShapefileFeatureWriter.java:260_) 
>
> at org.geotoolkit.data.DataUtilities.write(_DataUtilities.java:165_)
> at 
> org.geotoolkit.data.AbstractDataStore.handleAddWithFeatureWriter(_AbstractDataStore.java:576_) 
>
> at 
> org.geotoolkit.data.shapefile.ShapefileDataStore.addFeatures(_ShapefileDataStore.java:298_) 
>
> at 
> org.geotoolkit.data.AbstractDataStore.addFeatures(_AbstractDataStore.java:232_) 
>
> at 
> gov.usgs.bip.bisn.core.view.CreateShapefileDemo.main(_CreateShapefileDemo.java:37_) 
>
> Aug 3, 2012 2:24:25 PM org.geotoolkit.data.shapefile.ShpFiles 
> logCurrentLockers
> SEVERE: The following locker still has a lock? write on 
> file:/tmp/test.shx by StorageFile: test8028264144081471416.shx
>  it was created with the following stack trace
> org.geotoolkit.data.shapefile.ShpFilesLocker$Trace: Locking
> at 
> org.geotoolkit.data.shapefile.ShpFilesLocker.setTraceException(_ShpFilesLocker.java:50_) 
>
> at 
> org.geotoolkit.data.shapefile.ShpFilesLocker.<init>(_ShpFilesLocker.java:45_) 
>
> at 
> org.geotoolkit.data.shapefile.ShpFiles.acquireWrite(_ShpFiles.java:468_)
> at 
> org.geotoolkit.data.shapefile.StorageFile.getSrcURLForWrite(_StorageFile.java:167_) 
>
> at 
> org.geotoolkit.data.shapefile.StorageFile.replaceOriginals(_StorageFile.java:103_) 
>
> at 
> org.geotoolkit.data.shapefile.ShapefileFeatureWriter.clean(_ShapefileFeatureWriter.java:204_) 
>
> at 
> org.geotoolkit.data.shapefile.ShapefileFeatureWriter.close(_ShapefileFeatureWriter.java:260_) 
>
> at org.geotoolkit.data.DataUtilities.write(_DataUtilities.java:165_)
> at 
> org.geotoolkit.data.AbstractDataStore.handleAddWithFeatureWriter(_AbstractDataStore.java:576_) 
>
> at 
> org.geotoolkit.data.shapefile.ShapefileDataStore.addFeatures(_ShapefileDataStore.java:298_) 
>
> at 
> org.geotoolkit.data.AbstractDataStore.addFeatures(_AbstractDataStore.java:232_) 
>
> at 
> gov.usgs.bip.bisn.core.view.CreateShapefileDemo.main(_CreateShapefileDemo.java:37_) 
>
>
> and the code is here,
>
>
> import com.vividsolutions.jts.geom.Coordinate;
> import com.vividsolutions.jts.geom.GeometryFactory;
> import com.vividsolutions.jts.geom.Point;
> import java.net.URL;
> import java.util.ArrayList;
> import java.util.List;
> import org.geotoolkit.data.shapefile.ShapefileDataStore;
> import org.geotoolkit.feature.FeatureTypeBuilder;
> import org.geotoolkit.feature.FeatureUtilities;
> import org.geotoolkit.referencing.CRS;
> import org.geotoolkit.storage.DataStoreException;
> import org.opengis.feature.Feature;
> import org.opengis.feature.type.FeatureType;
>
> public class CreateShapefileDemo {
>         public static void main(String[] args) throws Exception {
>       // create a datastore toward the wanted path
>       final ShapefileDataStore store = new ShapefileDataStore(new URL(
>       "file:/tmp/test.shp"));
>       // create the feature type needed
>       final FeatureTypeBuilder ftb = new FeatureTypeBuilder();
>       ftb.setName("River");
>       ftb.add("the_geom", Point.class, CRS.decode("EPSG:4326"));
>       ftb.add("name", String.class);
>       final FeatureType type = ftb.buildFeatureType();
>       // add this model in the datastore
>       store.createSchema(type.getName(), type);
>       // create and store a feature
>       final List<Feature> features = new ArrayList<Feature>();
>       final Feature f = FeatureUtilities.defaultFeature(type, "id-0");
>       f.getProperty("the_geom").setValue(
>       new GeometryFactory().createPoint(new Coordinate(15, 20)));
>       f.getProperty("name").setValue("long river");
>       features.add(f);
>       store.addFeatures(type.getName(), features);
>         }
> }
> Douglas Kunzman
> 12201 Sunrise Valley Drive
> Reston, VA 20192
> Phone: 703 648-4234
> dkunzman at usgs.gov
>
>
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geotoolkit


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20120804/ed1bbd05/attachment.html>


More information about the Geotoolkit mailing list