Lire-0.9.4-beta1初始化DocumentBuilder出错
来源:互联网 发布:2017软考程序员真题 编辑:程序博客网 时间:2024/06/05 16:11
错误原因:0.9.4-beta1这个版本的net.semanticmetadata.lire.indexing.hashing包下缺少一个名为LshBitSampling.obj的文件
本人利用Maven导入Lire框架,可是Maven Repository中唯一的一个版本是0.9.4-kzwang-beta1(点击打开链接)
在做测试的时候报出了一个初始化错误:
Exception in thread "main" java.lang.ExceptionInInitializerErrorat net.semanticmetadata.lire.DocumentBuilderFactory.getDefaultDocumentBuilder(DocumentBuilderFactory.java:67)Caused by: java.lang.NullPointerExceptionat java.util.zip.InflaterInputStream.<init>(Unknown Source)at java.util.zip.GZIPInputStream.<init>(Unknown Source)at java.util.zip.GZIPInputStream.<init>(Unknown Source)at net.semanticmetadata.lire.indexing.hashing.BitSampling.readHashFunctions(BitSampling.java:148)at net.semanticmetadata.lire.impl.GenericDocumentBuilder.<clinit>(GenericDocumentBuilder.java:89)... 2 more
错误显示DocumentBuilder工厂在初始化DocumentBuilder时出错
我从“at net.semanticmetadata.lire.impl.GenericDocumentBuilder.<clinit>(GenericDocumentBuilder.java:89)”这个地方开始一层层往上寻找错误
直到最后一层“at java.util.zip.InflaterInputStream.<init>(Unknown Source)”,我看了源码是这样的:
public InflaterInputStream(InputStream in, Inflater inf, int size) { super(in); if (in == null || inf == null) { throw new NullPointerException(); } else if (size <= 0) { throw new IllegalArgumentException("buffer size <= 0"); } this.inf = inf; buf = new byte[size]; }从“if (in == null || inf == null) {
throw new NullPointerException();
}”这段代码可看出抛出空指针异常的原因是in或inf为空,但是inf在GZIPInputStream中通过new Inflater(true)创建,这个创建语句没有报错,说明inf不为空
所以抛出错误的原因就是in为空,这个in是在BitSampling.readHashFunctions方法中通过“BitSampling.class.getResourceAsStream(hashFunctionsFileName)”来创建的
hashFunctionsFileName的值为LshBitSampling.obj。
到这,我突然想到了点什么。(至于是什么我也不明白,反正我就很自然的做出下面的动作。。。。)
于是我就去找之前可以成功运行lire框架的项目,该项目的Lire框架版本为0.9.4-beta2。
我一层层打开,直到我打开net.semanticmetadata.lire.indexing.hashing包时,一切的错误都解决了,因为我新项目导入的0.9.4-beta1的
net.semanticmetadata.lire.indexing.hashing包下没有LshBitSampling.obj文件,而以前的项目中有此文件。
最后附上Lire官网:点击打开链接
- Lire-0.9.4-beta1初始化DocumentBuilder出错
- LIRe 源代码分析 4:建立索引(DocumentBuilder)[以颜色布局为例]
- LIRe 源代码分析 2:基本接口(DocumentBuilder)
- LIRE源代码分析 1:基本接口DocumentBuilder和ImageSearcher
- LIRE代码剖析4——LIRE中比较重要的方法
- DocumentBuilder解析
- Ubuntu Tweak 0.2.4 Beta1
- HTK初始化HMM出错
- c3p0连接池初始化出错
- DocumentBuilder.parse的问题。
- Lucene Image retrieval (LIRE)
- LIRE(Lucene Image Retrieval)
- Lire源码解析一
- LIRE Documentation详解
- lire Demo download
- DocumentBuilder.parse() returns [#Document: null]
- memset初始化类对象出错解析
- 使用shop++初始化数据库时出错
- 黑马程序员——OC字符串,点语法,成员变量,@property和@synthetic,构造方法
- 我的考博经验总结 CCER
- LabVIEW 编程思想(第2版)传送门
- kbengine 源代码读
- [LeetCode] Remove Linked List Elements
- Lire-0.9.4-beta1初始化DocumentBuilder出错
- Pascal's Triangle II
- [IOS]协议的简单使用
- PHP 开发社区微信服务号实战图解
- 三++21
- 100个Myeclipse6.5免费注册码
- IOS中屏幕截图(区域截图)
- p122第21题(成绩的最高分,平均分,及格人数)
- C#第二次作业--顺序图片显示器