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 Hugo Hardel <hu...@twazzup.com> on 2009/11/05 09:30:04 UTC

Using DataImportHandler basic http authentication

Thanks in advace for your help...I'm completely new to solr & I could use a
couple of pointers.

I am trying to use the DataImportHandler to fetch some xml documents via an
http API requiring basic authentication. Accessing the xml document from a
browser is not a problem uwith [http://user:password@host:port/path], but
when using the exact same URL in my dataConfig definition, the fetch fails
with a 401 (unauthorized) error.


Does the DataImportHandler support basic http authentication?...if yes what
am doing incorrectly? if not, any pointers or suggestions for workaround
would be much appreciated!!





Here is the stack trace for reference (I replaced the actual URL with the
template [http://user:password@host:port/path])

SEVERE: Full Import failed
org.apache.solr.handler.dataimport.DataImportHandlerException: Exception in
invoking url [http://user:password@host:port/path] Processing Document # 1
    at
org.apache.solr.handler.dataimport.HttpDataSource.getData(HttpDataSource.java:115)
    at
org.apache.solr.handler.dataimport.HttpDataSource.getData(HttpDataSource.java:47)
    at
org.apache.solr.handler.dataimport.XPathEntityProcessor.initQuery(XPathEntityProcessor.java:210)
    at
org.apache.solr.handler.dataimport.XPathEntityProcessor.fetchNextRow(XPathEntityProcessor.java:180)
    at
org.apache.solr.handler.dataimport.XPathEntityProcessor.nextRow(XPathEntityProcessor.java:163)
    at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:285)
    at
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:178)
    at
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:136)
    at
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:334)
    at
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:386)
    at
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:377)
Caused by: java.io.IOException: Server returned HTTP response code: 401 for
URL: [http://user:password@host:port/path]
    at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1313)
    at
org.apache.solr.handler.dataimport.HttpDataSource.getData(HttpDataSource.java:98)


Thanks!

Hugo

Re: Using DataImportHandler basic http authentication

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
DIH does not. The HttpDataSource does not support basic auth.

On Thu, Nov 5, 2009 at 2:00 PM, Hugo Hardel <hu...@twazzup.com> wrote:
> Thanks in advace for your help...I'm completely new to solr & I could use a
> couple of pointers.
>
> I am trying to use the DataImportHandler to fetch some xml documents via an
> http API requiring basic authentication. Accessing the xml document from a
> browser is not a problem uwith [http://user:password@host:port/path], but
> when using the exact same URL in my dataConfig definition, the fetch fails
> with a 401 (unauthorized) error.
>
>
> Does the DataImportHandler support basic http authentication?...if yes what
> am doing incorrectly? if not, any pointers or suggestions for workaround
> would be much appreciated!!
>
>
>
>
>
> Here is the stack trace for reference (I replaced the actual URL with the
> template [http://user:password@host:port/path])
>
> SEVERE: Full Import failed
> org.apache.solr.handler.dataimport.DataImportHandlerException: Exception in
> invoking url [http://user:password@host:port/path] Processing Document # 1
>    at
> org.apache.solr.handler.dataimport.HttpDataSource.getData(HttpDataSource.java:115)
>    at
> org.apache.solr.handler.dataimport.HttpDataSource.getData(HttpDataSource.java:47)
>    at
> org.apache.solr.handler.dataimport.XPathEntityProcessor.initQuery(XPathEntityProcessor.java:210)
>    at
> org.apache.solr.handler.dataimport.XPathEntityProcessor.fetchNextRow(XPathEntityProcessor.java:180)
>    at
> org.apache.solr.handler.dataimport.XPathEntityProcessor.nextRow(XPathEntityProcessor.java:163)
>    at
> org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:285)
>    at
> org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:178)
>    at
> org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:136)
>    at
> org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:334)
>    at
> org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:386)
>    at
> org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:377)
> Caused by: java.io.IOException: Server returned HTTP response code: 401 for
> URL: [http://user:password@host:port/path]
>    at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1313)
>    at
> org.apache.solr.handler.dataimport.HttpDataSource.getData(HttpDataSource.java:98)
>
>
> Thanks!
>
> Hugo
>



-- 
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com