简体   繁体   English

线程“ main”中的异常java.lang.NoClassDefFoundError:org / apache / http / NoHttpResponseException

[英]Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/http/NoHttpResponseException

Below code is for "Search using SolrJ". 以下代码用于“使用SolrJ进行搜索”。 When running code this error is shown. 运行代码时显示此错误。

IDE is netbean. IDE是netbean。

public static void main(String[] args) throws MalformedURLException, SolrServerException {
**HttpSolrServer solr = new HttpSolrServer("http://localhost:8983/solr");**

SolrQuery query = new SolrQuery();
query.setQuery("sony digital camera");
query.addFilterQuery("cat:electronics","store:amazon.com");
query.setFields("id","price","merchant","cat","store");
query.setStart(0);    
query.set("defType", "edismax");

QueryResponse response = solr.query(query);
SolrDocumentList results = response.getResults();
for (int i = 0; i < results.size(); ++i) {
  System.out.println(results.get(i));
}
}

Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/http/NoHttpResponseException 线程“ main”中的异常java.lang.NoClassDefFoundError:org / apache / http / NoHttpResponseException

You are missing NoHttpResponseException class in your classpath while running the code. 运行代码时,您在类路径中缺少NoHttpResponseException类。 To resolve this, just add apache httpcore-4.0.1.jar to your classpath. 要解决此问题,只需将apache httpcore-4.0.1.jar添加到您的类路径中。

My first guess would be that you are either missing the httpcore-4.0.jar or have an old version of it, since it used on 4.0 and after. 我的第一个猜测可能是您丢失了httpcore-4.0.jar或使用了旧版本,因为它在4.0及以后版本中使用。

Also check if you have it in the deployment path. 还要检查是否在部署路径中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 线程“main”中的异常 java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient - Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient 线程“ main”中的异常java.lang.NoClassDefFoundError:org / apache / http / HttpEntity - Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/http/HttpEntity 线程“main”中的异常java.lang.NoClassDefFoundError:org / apache / http / ConnectionReuseStrategy: - Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/http/ConnectionReuseStrategy: Java Apache Spark Maven Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/SparkConf - Java Apache Spark Maven Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/SparkConf 使用Crawler4j时,线程“ main”中的异常java.lang.NoClassDefFoundError:org / apache / http / conn / scheme / SchemeSocketFactory - Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/http/conn/scheme/SchemeSocketFactory while Using Crawler4j 线程“ main”中的异常java.lang.NoClassDefFoundError:org / apache / commons / lang / builder / CompareToBuilder - Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/lang/builder/CompareToBuilder 线程“main”中的异常 java.lang.NoClassDefFoundError: org/apache/commons/lang3/ObjectUtils - Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/ObjectUtils 线程“主”中的java异常java.lang.NoClassDefFoundError:org / apache / commons / io / FileUtils - java Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils Spark和Cassandra Java应用程序:线程“ main”中的异常java.lang.NoClassDefFoundError:org / apache / spark / sql / Dataset - Spark and Cassandra Java application: Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/spark/sql/Dataset 线程“ main”中的异常java.lang.NoClassDefFoundError:org / mockito / Mockito - Exception in thread “main” java.lang.NoClassDefFoundError: org/mockito/Mockito
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM