linqy的个人博客分享 http://blog.sciencenet.cn/u/linqy

博文

org.geotools.data.shapefile.files.ShpFiles logCurrentLocker

已有 6401 次阅读 2017-10-16 19:26 |个人分类:java|系统分类:科研笔记| java, geotools, shp读取

今天在利用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();
//提交索引到磁盘上的索引库,关闭索引器









https://blog.sciencenet.cn/blog-3134052-1081104.html

上一篇:堆和栈的区别
下一篇:Lucene分词结果的查看
收藏 IP: 111.195.160.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-26 10:49

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部