|||
今天在利用Lucene通过geotools工具对shp文件内容读取并进行建立索引是,出现了下面额错误:
开始建立索引...
Error while parsing JAI registry file "file:/D:/java_test/geotools-17.1/imageio-ext-imagereadmt-1.1M012010.jar!/META-INF/registryFile.jai" :
Error in registry file at line number #29
A descriptor is already registered against the name "ImageReadMT" under registry mode "rendered"
十月 16, 2017 7:14:29 下午 org.geotools.image.ImageWorker <clinit>
信息: Warp/affine reduction enabled: true
完成 10000 个索引。
完成 20000 个索引。
完成 30000 个索引。
完成 40000 个索引。
org.geotools.data.shapefile.files.ShpFiles logCurrentLockers
严重: The following locker still has a lock: read on file:/D:/java_test/lucene/data/testdata/SM_LS_T_LH_PT.shp by org.geotools.data.shapefile.shp.ShapefileReader
org.geotools.data.shapefile.files.ShpFiles logCurrentLockers
严重: The following locker still has a lock: read on file:/D:/java_test/lucene/data/testdata/SM_LS_T_LH_PT.shx by org.geotools.data.shapefile.shp.IndexFil
十月 16, 2017 7:14:33 下午 org.geotools.data.shapefile.files.ShpFiles logCurrentLockers
严重: The following locker still has a lock: read on file:/D:/java_test/lucene/data/testdata/SM_LS_T_LH_PT.dbf by org.geotools.data.shapefile.dbf.DbaseFileReader
完成 50000 个索引。
完成 60000 个索引。
经过 网上搜索答案,和结合自己之前的知识,原因很简单,是由于粗心在建立了shpdatastore创建之后,没有关闭,导致了上述的错误。
//shp文件的读取
ShapefileDataStore shpDataStore = null;
File shpfile = new File(shppath);
shpDataStore = new ShapefileDataStore(shpfile.toURI().toURL());
在将shpdatastore关闭之后,问题就没有了
itertor.close();
shpDataStore.dispose();//使用之后必须关掉
shpfile.exists();
indexWriter.close();//提交索引到磁盘上的索引库,关闭索引器
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-9-27 06:58
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社