gpt4 book ai didi

java.lang.NoClassDefFoundError : org/noggit/CharArr while adding document to be indexed in solr 错误

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:11:26 24 4
gpt4 key购买 nike

我正在使用 java 客户端程序将数据添加到我的 solr 服务器中的索引。我的来源看起来像:-

SolrServer solrServer = new HttpSolrServer("http://10.219.224.91:4040/solr/test");
System.out.println("<ul>");
String[] passengerType={"Infant","Handicapped","Unaccompanied minor", "General Category"};
for(int i = 0; i < 100; i++) {
SolrInputDocument solrInputDocument = new SolrInputDocument();
solrInputDocument.addField("id", new String("widget " + i));
// add three random categories
for(int j = 0; j < 3; j++) {
solrInputDocument.addField("category", passengerType[new Random().nextInt(passengerType.length)]);
}
solrInputDocument.addField("size", new Random().nextInt(10));
// this is cheating below - but saves us from the query string...
solrInputDocument.addField("text", "a");
solrServer.add(solrInputDocument);
System.out.println("<li> Adding: " + solrInputDocument + "</li>\n");
}
System.out.println("</ul>");
solrServer.commit();

在运行应用程序时我得到:-

Exception in thread "main" java.lang.NoClassDefFoundError: org/noggit/CharArr at org.apache.solr.common.util.JavaBinCodec.(JavaBinCodec.java:474) at org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41) at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:407) at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180) at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117) at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116) at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:102) at IndexDriver.main(IndexDriver.java:39) Caused by: java.lang.ClassNotFoundException: org.noggit.CharArr at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source)

此行出现错误-

solrServer.add(solrInputDocument);

我们将不胜感激任何帮助。

最佳答案

我认为你没有在你的程序中包含 noggit-0.5.jar 文件

http://www.java2s.com/Code/Jar/n/Downloadnoggit05jar.htm下载

或者 Maven-Repository

然后将其导入到您的项目库中。

关于java.lang.NoClassDefFoundError : org/noggit/CharArr while adding document to be indexed in solr 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19426861/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com