我自己编写了一个tokenizer插件,并成功编译了maven。并且弹性搜索在安装后运行良好。但是,当我尝试使用它来分段句子时,我得到错误信息:
java.lang.NoClassDefFoundError: com/github/kevinsawicki/http/HttpRequest
at org.elasticsearch.thulac.MyTokenizer.thulacSeg(MyTokenizer.java:32)
at org.elasticsearch.thulac.MyTokenizer.<init>(MyTokenizer.java:64)
at org.elasticsearch.thulac.MyAnalyzer.createComponents(MyAnalyzer.java:12)
at org.apache.lucene.analysis.AnalyzerWrapper.createComponents(AnalyzerWrapper.java:113)
at org.apache.lucene.analysis.Analyzer.tokenStream(Analyzer.java:182)
at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:230)
at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:60)
at org.elasticsearch.action.support.single.custom.TransportSingleCustomOperationAction$AsyncSingleAction$1.run(TransportSingleCustomOperationAction.java:161)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
我使用kevinsawicki/http-request。是因为我没有把http请求jar放到elasticsearch java路径中吗?如果有必要,我应该把它放在哪里?
谢谢。
答案 0 :(得分:0)
是的,您需要将jar文件提供给elasticsearch的lib文件夹。
在哪儿?这取决于安装elasticsearch的位置。例如。使用find / -type d -name elasticsearch
找到目录。在Centos上它是/usr/share/elasticsearch/
,其中包含lib
子文件夹。或者更舒服:
dpkg -L elasticsearch
和rpm -ql elasticsearch
查找。尝试在此lib
文件夹中部署代码和所有相关库。