Hi i am new to geotools and i am trying to run a simple write example. I
have an existing shape file which has features in it i am attempting to
open and modify. The line  FeatureWriter
writer=store.getFeatureWriter(t); appears to set 4 readLocks and when
the t.commit executes i get a stacktrace complaining about : The
following locker still has a lock?
 
 
FileDataStore store = FileDataStoreFinder.getDataStore(getFile());
Transaction t = new DefaultTransaction("handle");
FeatureWriter writer=store.getFeatureWriter(t);
Feature feature=writer.next();
feature.getProperty("NAME").setValue("Main St");
writer.write();
t.commit(); // commit operations
writer.close();
t.close();
 
 
Nov 18, 2010 4:43:09 PM org.geotools.data.shapefile.StorageFile
replaceOriginals
SEVERE: Unable to delete the file:
C:\geotools\example\src\Streets\Streets.shp when attempting to replace
with temporary copy.
Nov 18, 2010 4:43:09 PM org.geotools.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
Nov 18, 2010 4:43:09 PM org.geotools.data.shapefile.ShpFiles
logCurrentLockers
SEVERE: The following locker still has a lock? read on
file:/C:/geotools/example/src/Streets/Streets.dbf by
org.geotools.data.shapefile.dbf.IndexedDbaseFileReader
 it was created with the following stack trace
org.geotools.data.shapefile.ShpFilesLocker$Trace: Locking
file:/C:/geotools/example/src/Streets/Streets.dbf for read by
org.geotools.data.shapefile.dbf.IndexedDbaseFileReader in thread main
 at
org.geotools.data.shapefile.ShpFilesLocker.setTraceException(ShpFilesLoc
ker.java:72)
 at
org.geotools.data.shapefile.ShpFilesLocker.<init>(ShpFilesLocker.java:36
)
 at org.geotools.data.shapefile.ShpFiles.acquireRead(ShpFiles.java:365)
 at
org.geotools.data.shapefile.ShpFiles.getReadChannel(ShpFiles.java:813)
 at
org.geotools.data.shapefile.dbf.DbaseFileReader.<init>(DbaseFileReader.j
ava:139)
 at
org.geotools.data.shapefile.dbf.IndexedDbaseFileReader.<init>(IndexedDba
seFileReader.java:121)
 at
org.geotools.data.shapefile.indexed.IndexedShapefileDataStore.openDbfRea
der(IndexedShapefileDataStore.java:709)
 at
org.geotools.data.shapefile.indexed.IndexedShapefileDataStore.getAttribu
tesReader(IndexedShapefileDataStore.java:454)
 at
org.geotools.data.shapefile.indexed.IndexedShapefileDataStore.getFeature
Reader(IndexedShapefileDataStore.java:325)
 at
org.geotools.data.TransactionStateDiff.writer(TransactionStateDiff.java:
334)
 at
org.geotools.data.AbstractDataStore.getFeatureWriter(AbstractDataStore.j
ava:499)
 at
org.geotools.data.AbstractDataStore.getFeatureWriter(AbstractDataStore.j
ava:525)
 at
org.geotools.data.AbstractFileDataStore.getFeatureWriter(AbstractFileDat
aStore.java:91)
 at com.rii.geotools.Quickstart.writeSomething(Quickstart.java:122)
 at com.rii.geotools.Quickstart.main(Quickstart.java:70)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Nov 18, 2010 4:43:09 PM org.geotools.data.shapefile.ShpFiles
logCurrentLockers
SEVERE: The following locker still has a lock? read on
file:/C:/geotools/example/src/Streets/Streets.shp by
org.geotools.data.shapefile.shp.ShapefileReader
 it was created with the following stack trace
org.geotools.data.shapefile.ShpFilesLocker$Trace: Locking
file:/C:/geotools/example/src/Streets/Streets.shp for read by
org.geotools.data.shapefile.shp.ShapefileReader in thread main
 at
org.geotools.data.shapefile.ShpFilesLocker.setTraceException(ShpFilesLoc
ker.java:72)
 at
org.geotools.data.shapefile.ShpFilesLocker.<init>(ShpFilesLocker.java:36
)
 at org.geotools.data.shapefile.ShpFiles.acquireRead(ShpFiles.java:365)
 at
org.geotools.data.shapefile.ShpFiles.getReadChannel(ShpFiles.java:813)
 at
org.geotools.data.shapefile.shp.ShapefileReader.<init>(ShapefileReader.j
ava:213)
 at
org.geotools.data.shapefile.ShapefileDataStore.openShapeReader(Shapefile
DataStore.java:453)
 at
org.geotools.data.shapefile.indexed.IndexedShapefileDataStore.getAttribu
tesReader(IndexedShapefileDataStore.java:458)
 at
org.geotools.data.shapefile.indexed.IndexedShapefileDataStore.getFeature
Reader(IndexedShapefileDataStore.java:325)
 at
org.geotools.data.TransactionStateDiff.writer(TransactionStateDiff.java:
334)
 at
org.geotools.data.AbstractDataStore.getFeatureWriter(AbstractDataStore.j
ava:499)
 at
org.geotools.data.AbstractDataStore.getFeatureWriter(AbstractDataStore.j
ava:525)
 at
org.geotools.data.AbstractFileDataStore.getFeatureWriter(AbstractFileDat
aStore.java:91)
 at com.rii.geotools.Quickstart.writeSomething(Quickstart.java:122)
 at com.rii.geotools.Quickstart.main(Quickstart.java:70)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Nov 18, 2010 4:43:09 PM org.geotools.data.shapefile.ShpFiles
logCurrentLockers
SEVERE: The following locker still has a lock? read on
file:/C:/geotools/example/src/Streets/Streets.shx by
org.geotools.data.shapefile.shp.IndexFile
 it was created with the following stack trace
org.geotools.data.shapefile.ShpFilesLocker$Trace: Locking
file:/C:/geotools/example/src/Streets/Streets.shx for read by
org.geotools.data.shapefile.shp.IndexFile in thread main
 at
org.geotools.data.shapefile.ShpFilesLocker.setTraceException(ShpFilesLoc
ker.java:72)
 at
org.geotools.data.shapefile.ShpFilesLocker.<init>(ShpFilesLocker.java:36
)
 at org.geotools.data.shapefile.ShpFiles.acquireRead(ShpFiles.java:365)
 
 
 
etc......

Gunner Lehr | Senior Software Engineer 

RESOURCE INTERNATIONAL, INC. 
6350 Presidential Gateway | Columbus, Ohio 43231 
Phone: 614.823.4949 | Fax: 614.823.4990 | E-mail:
gunn...@resourceinternational.com

GSA Schedule GS-35F-0397V

 
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to