我有一個solr實例正在運行,並且能夠通過瀏覽器訪問它並使用Admin運行查詢。當我嘗試通過在Eclipse Java代碼來訪問它,但是,我收到以下錯誤:從Eclipse訪問Solr時出現404錯誤
Exception in thread "main" org.apache.solr.common.SolrException: Server at http://localhost:8983/solr returned non ok status:404, message:Not Found
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:372)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
at testClass.main(testClass.java:18)
這裏是我運行代碼:
public static void main(String[] args) throws MalformedURLException, SolrServerException {
SolrServer server = new HttpSolrServer("http://localhost:8983/solr/");
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("myParam", "myValue");
QueryResponse response = server.query(params);
}
我在這兩種情況下得到同樣的錯誤 – vincentvanjoe