You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Carl Roberts <ca...@gmail.com> on 2015/01/22 17:18:15 UTC

Is there a way to pass in proxy settings to Solr?

Hi,

Is there a way to pass in proxy settings to Solr?

The reason that I am asking this question is that I am trying to run the 
DIH RSS example, and it is not working when I try to import the RSS feed 
URL because the code in Solr comes back with an unknown host exception 
due to the proxy that we use at work.

If I use the curl tool and the environment variable http_proxy to access 
the RSS feed directly it works, but it appears Solr does not use that 
environment variable because it is throwing this error:

39642 [Thread-15] ERROR org.apache.solr.handler.dataimport.URLDataSource 
– Exception thrown while getting data
java.net.UnknownHostException: rss.slashdot.org
at 
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
at sun.net.www.http.HttpClient.New(HttpClient.java:308)
at sun.net.www.http.HttpClient.New(HttpClient.java:326)
at 
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996)
at 
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:932)
at 
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:850)
at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300)
at 
org.apache.solr.handler.dataimport.URLDataSource.getData(URLDataSource.java:98)
at 
org.apache.solr.handler.dataimport.URLDataSource.getData(URLDataSource.java:42)
at 
org.apache.solr.handler.dataimport.XPathEntityProcessor.initQuery(XPathEntityProcessor.java:283)
at 
org.apache.solr.handler.dataimport.XPathEntityProcessor.fetchNextRow(XPathEntityProcessor.java:224)
at 
org.apache.solr.handler.dataimport.XPathEntityProcessor.nextRow(XPathEntityProcessor.java:204)
at 
org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:243)
at 
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:476)
at 
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:415)
at 
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:330)
at 
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:232)
at 
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:416)
at 
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:480)
at 
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:461)

Thanks in advance,

Joe


Re: Is there a way to pass in proxy settings to Solr?

Posted by Carl Roberts <ca...@gmail.com>.
Hi Shawn,

I got it to work by using this script to start my instance of Solr:

java *-Dhttp.proxyHost=http-proxy-server -Dhttp.http.proxyPort=80 
-Dhttps.proxyHost=http-proxy-server -Dhttps.proxyPort=80* 
-Dlog4j.debug=true 
-Dlog4j.configuration=file:///Users/carlroberts/dev/solr-4.10.3/log4j.xml -Dsolr.solr.home=../ 
-classpath "./:lib/*:./log4j.xml" -jar start.jar


Regards,

Joe
On 1/22/15, 11:46 AM, Shawn Heisey wrote:
> On 1/22/2015 9:18 AM, Carl Roberts wrote:
>> Is there a way to pass in proxy settings to Solr?
>>
>> The reason that I am asking this question is that I am trying to run
>> the DIH RSS example, and it is not working when I try to import the
>> RSS feed URL because the code in Solr comes back with an unknown host
>> exception due to the proxy that we use at work.
>>
>> If I use the curl tool and the environment variable http_proxy to
>> access the RSS feed directly it works, but it appears Solr does not
>> use that environment variable because it is throwing this error:
>>
>> 39642 [Thread-15] ERROR
>> org.apache.solr.handler.dataimport.URLDataSource – Exception thrown
>> while getting data
> Checking the code, URLDataSource seems to use the URL capability that
> comes with Java itself.  The system properties on this page are very
> likely to affect objects that come with Java:
>
> http://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html#Proxies
>
> You would need to set these properties on the java commandline that
> starts your servlet container, with the -D option.
>
> Thanks,
> Shawn
>


Re: Is there a way to pass in proxy settings to Solr?

Posted by Shawn Heisey <ap...@elyograg.org>.
On 1/22/2015 9:18 AM, Carl Roberts wrote:
> Is there a way to pass in proxy settings to Solr?
>
> The reason that I am asking this question is that I am trying to run
> the DIH RSS example, and it is not working when I try to import the
> RSS feed URL because the code in Solr comes back with an unknown host
> exception due to the proxy that we use at work.
>
> If I use the curl tool and the environment variable http_proxy to
> access the RSS feed directly it works, but it appears Solr does not
> use that environment variable because it is throwing this error:
>
> 39642 [Thread-15] ERROR
> org.apache.solr.handler.dataimport.URLDataSource – Exception thrown
> while getting data

Checking the code, URLDataSource seems to use the URL capability that
comes with Java itself.  The system properties on this page are very
likely to affect objects that come with Java:

http://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html#Proxies

You would need to set these properties on the java commandline that
starts your servlet container, with the -D option.

Thanks,
Shawn