返回信息流java小白向各位大神学霸虚心求教
最近在linux服务器上配置Lucene,java环境为1.7.0_25,lucene版本号为3.6.2
使用的lucene代码为IndexFiles.java,代码除了把package那一行去掉外其他的没有更改过,然后javac编译通过,但是用java命令运行时有异常:
Exception in thread "main" java.lang.IllegalArgumentException: Could not find implementing class for org.apache.lucene.analysis.tokenattributes.OffsetAttribute
at org.apache.lucene.util.AttributeSource$AttributeFactory$DefaultAttributeFactory.getClassForInterface(AttributeSource.java:94)
at org.apache.lucene.util.AttributeSource$AttributeFactory$DefaultAttributeFactory.createAttributeInstance(AttributeSource.java:67)
at org.apache.lucene.util.AttributeSource.addAttribute(AttributeSource.java:276)
at org.apache.lucene.index.DocInverterPerThread$SingleTokenAttributeSource.<init>(DocInverterPerThread.java:42)
at org.apache.lucene.index.DocInverterPerThread$SingleTokenAttributeSource.<init>(DocInverterPerThread.java:36)
at org.apache.lucene.index.DocInverterPerThread.<init>(DocInverterPerThread.java:34)
at org.apache.lucene.index.DocInverter.addThread(DocInverter.java:90)
at org.apache.lucene.index.DocFieldProcessorPerThread.<init>(DocFieldProcessorPerThread.java:64)
at org.apache.lucene.index.DocFieldProcessor.addThread(DocFieldProcessor.java:86)
at org.apache.lucene.index.DocumentsWriterThreadState.<init>(DocumentsWriterThreadState.java:42)
at org.apache.lucene.index.DocumentsWriter.getThreadState(DocumentsWriter.java:713)
at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:754)
at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:2328)
at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:2300)
at IndexFiles.indexDocs(IndexFiles.java:206)
at IndexFiles.indexDocs(IndexFiles.java:153)
at IndexFiles.main(IndexFiles.java:108)
但是这些代码在Eclipse下能运行,请问是我的配置不正确吗?还是需要对源码进行更改?
这是一条镜像帖。来源:北邮人论坛 / java / #26273同步于 2013/7/8
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Java机器人发帖
[问题]【求救】在linux服务器上配置Lucene运行时出错
p40
2013/7/8镜像同步2 回复
订阅后,新回复会通过你的通知中心匿名送达。
2 条回复
Could not find implementing class for org.apache.lucene.analysis.tokenattributes.OffsetAttribute
可能是没有把lucene的包,放进你工程的lib文件夹,没有找到你的jar包?
这个包是原程序自带的.java,我没有更改过,不知道为什么程序没有找到……
今天试着把工程生成.jar包,然后就好使了,不明真相
【 在 peterGG 的大作中提到: 】
: Could not find implementing class for org.apache.lucene.analysis.tokenattributes.OffsetAttribute
: 可能是没有把lucene的包,放进你工程的lib文件夹,没有找到你的jar包?