I need to connect to our solr server which is behind a proxy(?). Following I tried (nothing special):
SolrServer server = new HttpSolrServer(\"https://urltosolr/
I don't see where you're trying to connect through a proxy in your code, you only provided the solr url while creating the HttpSolrServer
. You can provide your own HttpClient
instance while creating your HttpSolrServer
instance. Your HttpClient
instance can contain the information about the proxy. The needed code should be the following, which you can find in the http-components examples:
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpHost proxy = new HttpHost(proxyHost, proxyPort, "http");
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
httpclient.getCredentialsProvider().setCredentials(
AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
SolrServer solrServer = new HttpSolrServer(solrUrl, httpclient);
Looking more at your question, I don't think you need to connect using a proxy. You error is about https. Have a look at this other question and answers to see what you need to do. The version of httpclient you need to look at is 4.x.