<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hello,<br>
<br>
The demo has been written for the latest Geotoolkit version
(download it here) :<br>
<a class="moz-txt-link-freetext" href="http://jenkins.geotoolkit.org">http://jenkins.geotoolkit.org</a><br>
<a class="moz-txt-link-freetext" href="http://jenkins.geotoolkit.org/job/Geotoolkit-pending/lastSuccessfulBuild/artifact/target/bundles/geotk-shell.zip">http://jenkins.geotoolkit.org/job/Geotoolkit-pending/lastSuccessfulBuild/artifact/target/bundles/geotk-shell.zip</a><br>
<br>
The ShpFilesLocker class which is causing problems in your case
was replaced in december 2011.<br>
Version 3.19 does not contain this fix unfortunatly, you will have
to use the 3.x-SNAPSHOT version until our next release.<br>
<br>
<br>
<br>
Johann Sorel<br>
Geomatys<br>
<br>
<br>
<br>
<br>
On 03/08/2012 20:30, Doug Kunzman wrote:<br>
</div>
<blockquote
cite="mid:OFA008A694.C0C1EAA1-ON85257A4F.00652EFB-85257A4F.0065B560@usgs.gov"
type="cite"><font face="sans-serif" size="2">I'm trying to use the
Geotoolkit 3.19 with
Java 1.6 x64 to create a shapefile on Windows 7 PC. </font>
<br>
<font face="sans-serif" size="2">After considerable frustration I
executed
the sample and am getting a similar error that I'm getting in my
code.
</font>
<br>
<br>
<font face="sans-serif" size="2">Does anyone have any ideas what
could
be wrong?</font>
<br>
<br>
<font face="sans-serif" size="2">The error is as follows,</font>
<br>
<font color="red" face="Consolas" size="2">ug 3, 2012 2:24:25 PM
org.geotoolkit.referencing.factory.epsg.ThreadedEpsgFactory
createBackingStore</font>
<br>
<font color="red" face="Consolas" size="2">INFO: Connected to EPSG
database
“jdbc:hsqldb:C:\Users\dkunzman\Application
Data\Geotoolkit.org\EPSG\HSQL/7.09”
on “HSQL Database Engine”.</font>
<br>
<font color="red" face="Consolas" size="2">Aug 3, 2012 2:24:25 PM
org.geotoolkit.data.shapefile.StorageFile
replaceOriginals</font>
<br>
<font color="red" face="Consolas" size="2">SEVERE: Unable to
delete the
file: \tmp\test.shx when attempting to replace with temporary
copy.</font>
<br>
<font color="red" face="Consolas" size="2">Aug 3, 2012 2:24:25 PM
org.geotoolkit.data.shapefile.StorageFile
replaceOriginals</font>
<br>
<font color="red" face="Consolas" size="2">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</font>
<br>
<font color="red" face="Consolas" size="2">Aug 3, 2012 2:24:25 PM
org.geotoolkit.data.shapefile.ShpFiles
logCurrentLockers</font>
<br>
<font color="red" face="Consolas" size="2">SEVERE: The following
locker
still has a lock? write on <a class="moz-txt-link-freetext" href="file:/tmp/test.shp">file:/tmp/test.shp</a> by StorageFile:
test5109458120423620803.shp</font>
<br>
<font color="red" face="Consolas" size="2"> it was created with
the
following stack trace</font>
<br>
<font color="red" face="Consolas" size="2">org.geotoolkit.data.shapefile.ShpFilesLocker$Trace:
Locking
</font>
<br>
<font color="red" face="Consolas" size="2">
at
org.geotoolkit.data.shapefile.ShpFilesLocker.setTraceException(</font><font
color="#000080" face="Consolas" size="2"><u>ShpFilesLocker.java:50</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.ShpFilesLocker.<init>(</font><font
color="#000080" face="Consolas" size="2"><u>ShpFilesLocker.java:45</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.ShpFiles.acquireWrite(</font><font
color="#000080" face="Consolas" size="2"><u>ShpFiles.java:468</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.StorageFile.getSrcURLForWrite(</font><font
color="#000080" face="Consolas" size="2"><u>StorageFile.java:167</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.StorageFile.replaceOriginals(</font><font
color="#000080" face="Consolas" size="2"><u>StorageFile.java:103</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.ShapefileFeatureWriter.clean(</font><font
color="#000080" face="Consolas" size="2"><u>ShapefileFeatureWriter.java:204</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.ShapefileFeatureWriter.close(</font><font
color="#000080" face="Consolas" size="2"><u>ShapefileFeatureWriter.java:260</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.DataUtilities.write(</font><font
color="#000080" face="Consolas" size="2"><u>DataUtilities.java:165</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at
org.geotoolkit.data.AbstractDataStore.handleAddWithFeatureWriter(</font><font
color="#000080" face="Consolas" size="2"><u>AbstractDataStore.java:576</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.ShapefileDataStore.addFeatures(</font><font
color="#000080" face="Consolas" size="2"><u>ShapefileDataStore.java:298</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.AbstractDataStore.addFeatures(</font><font
color="#000080" face="Consolas" size="2"><u>AbstractDataStore.java:232</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at gov.usgs.bip.bisn.core.view.CreateShapefileDemo.main(</font><font
color="#000080" face="Consolas" size="2"><u>CreateShapefileDemo.java:37</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">Aug 3, 2012 2:24:25 PM
org.geotoolkit.data.shapefile.ShpFiles
logCurrentLockers</font>
<br>
<font color="red" face="Consolas" size="2">SEVERE: The following
locker
still has a lock? write on <a class="moz-txt-link-freetext" href="file:/tmp/test.shx">file:/tmp/test.shx</a> by StorageFile:
test8028264144081471416.shx</font>
<br>
<font color="red" face="Consolas" size="2"> it was created with
the
following stack trace</font>
<br>
<font color="red" face="Consolas" size="2">org.geotoolkit.data.shapefile.ShpFilesLocker$Trace:
Locking
</font>
<br>
<font color="red" face="Consolas" size="2">
at
org.geotoolkit.data.shapefile.ShpFilesLocker.setTraceException(</font><font
color="#000080" face="Consolas" size="2"><u>ShpFilesLocker.java:50</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.ShpFilesLocker.<init>(</font><font
color="#000080" face="Consolas" size="2"><u>ShpFilesLocker.java:45</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.ShpFiles.acquireWrite(</font><font
color="#000080" face="Consolas" size="2"><u>ShpFiles.java:468</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.StorageFile.getSrcURLForWrite(</font><font
color="#000080" face="Consolas" size="2"><u>StorageFile.java:167</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.StorageFile.replaceOriginals(</font><font
color="#000080" face="Consolas" size="2"><u>StorageFile.java:103</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.ShapefileFeatureWriter.clean(</font><font
color="#000080" face="Consolas" size="2"><u>ShapefileFeatureWriter.java:204</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.ShapefileFeatureWriter.close(</font><font
color="#000080" face="Consolas" size="2"><u>ShapefileFeatureWriter.java:260</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.DataUtilities.write(</font><font
color="#000080" face="Consolas" size="2"><u>DataUtilities.java:165</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at
org.geotoolkit.data.AbstractDataStore.handleAddWithFeatureWriter(</font><font
color="#000080" face="Consolas" size="2"><u>AbstractDataStore.java:576</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.shapefile.ShapefileDataStore.addFeatures(</font><font
color="#000080" face="Consolas" size="2"><u>ShapefileDataStore.java:298</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at org.geotoolkit.data.AbstractDataStore.addFeatures(</font><font
color="#000080" face="Consolas" size="2"><u>AbstractDataStore.java:232</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<font color="red" face="Consolas" size="2">
at gov.usgs.bip.bisn.core.view.CreateShapefileDemo.main(</font><font
color="#000080" face="Consolas" size="2"><u>CreateShapefileDemo.java:37</u></font><font
color="red" face="Consolas" size="2">)</font>
<br>
<br>
<font face="sans-serif" size="2">and the code is here,</font>
<br>
<br>
<br>
<font face="sans-serif" size="2">import
com.vividsolutions.jts.geom.Coordinate;</font>
<br>
<font face="sans-serif" size="2">import
com.vividsolutions.jts.geom.GeometryFactory;</font>
<br>
<font face="sans-serif" size="2">import
com.vividsolutions.jts.geom.Point;</font>
<br>
<font face="sans-serif" size="2">import java.net.URL;</font>
<br>
<font face="sans-serif" size="2">import java.util.ArrayList;</font>
<br>
<font face="sans-serif" size="2">import java.util.List;</font>
<br>
<font face="sans-serif" size="2">import
org.geotoolkit.data.shapefile.ShapefileDataStore;</font>
<br>
<font face="sans-serif" size="2">import
org.geotoolkit.feature.FeatureTypeBuilder;</font>
<br>
<font face="sans-serif" size="2">import
org.geotoolkit.feature.FeatureUtilities;</font>
<br>
<font face="sans-serif" size="2">import
org.geotoolkit.referencing.CRS;</font>
<br>
<font face="sans-serif" size="2">import
org.geotoolkit.storage.DataStoreException;</font>
<br>
<font face="sans-serif" size="2">import
org.opengis.feature.Feature;</font>
<br>
<font face="sans-serif" size="2">import
org.opengis.feature.type.FeatureType;</font>
<br>
<br>
<font face="sans-serif" size="2">public class CreateShapefileDemo
{</font>
<br>
<font face="sans-serif" size="2"> public
static void main(String[] args) throws Exception {</font>
<br>
<font face="sans-serif" size="2">
// create a datastore toward the wanted path</font>
<br>
<font face="sans-serif" size="2">
final ShapefileDataStore store = new
ShapefileDataStore(new
URL(</font>
<br>
<font face="sans-serif" size="2">
<a class="moz-txt-link-rfc2396E" href="file:/tmp/test.shp">"file:/tmp/test.shp"</a>));</font>
<br>
<font face="sans-serif" size="2">
// create the feature type needed</font>
<br>
<font face="sans-serif" size="2">
final FeatureTypeBuilder ftb = new FeatureTypeBuilder();</font>
<br>
<font face="sans-serif" size="2">
ftb.setName("River");</font>
<br>
<font face="sans-serif" size="2">
ftb.add("the_geom", Point.class,
CRS.decode("EPSG:4326"));</font>
<br>
<font face="sans-serif" size="2">
ftb.add("name", String.class);</font>
<br>
<font face="sans-serif" size="2">
final FeatureType type = ftb.buildFeatureType();</font>
<br>
<font face="sans-serif" size="2">
// add this model in the datastore</font>
<br>
<font face="sans-serif" size="2">
store.createSchema(type.getName(), type);</font>
<br>
<font face="sans-serif" size="2">
// create and store a feature</font>
<br>
<font face="sans-serif" size="2">
final List<Feature> features = new
ArrayList<Feature>();</font>
<br>
<font face="sans-serif" size="2">
final Feature f = FeatureUtilities.defaultFeature(type,
"id-0");</font>
<br>
<font face="sans-serif" size="2">
f.getProperty("the_geom").setValue(</font>
<br>
<font face="sans-serif" size="2">
new GeometryFactory().createPoint(new Coordinate(15,
20)));</font>
<br>
<font face="sans-serif" size="2">
f.getProperty("name").setValue("long
river");</font>
<br>
<font face="sans-serif" size="2">
features.add(f);</font>
<br>
<font face="sans-serif" size="2">
store.addFeatures(type.getName(), features);</font>
<br>
<font face="sans-serif" size="2"> }</font>
<br>
<font face="sans-serif" size="2">}</font>
<br>
<font face="sans-serif" size="2">Douglas Kunzman<br>
12201 Sunrise Valley Drive<br>
Reston, VA 20192<br>
Phone: 703 648-4234<br>
<a class="moz-txt-link-abbreviated" href="mailto:dkunzman@usgs.gov">dkunzman@usgs.gov</a><br>
</font>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Geotoolkit mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Geotoolkit@lists.osgeo.org">Geotoolkit@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/geotoolkit">http://lists.osgeo.org/mailman/listinfo/geotoolkit</a>
</pre>
</blockquote>
<br>
<br>
</body>
</html>