A Dev A Dev - 1 year ago 108
Java Question

SolrJ connect to Solr from Java

I'm trying to connect from my Java code to a Solr server running 5.3.1 using the same version of SolrJ. I keep getting a message in Eclipse that HttpSolrServer is deprecated, but cannot find anywhere what it has been replaced with. Does anyone know how I can connect to Solr from Java using SolrJ using something current? The SolrJ documentation all seems to suggest that HttpSolrServer is the supported way, but Eclipse is not happy about it.

Answer Source

Eclipse marks every class that has @Deprecated annotation as deprecated.
HttpSolrServer was deprecated indeed and HttpSolrClient is its replacment

SolrClient client = new HttpSolrClient("coreUrl");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download