Saturday, 26 January 2013

1) Download the Apache Solr 3.6 and build the example.

2) Edit  /example/etc/jetty.xml

<Set name="UserRealms">
<Array type="">
<New class="">
                   <Set name="name">Test Realm</Set>
                   <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/</Set>

3) Edit /example/etc/webdefault.xml

           <web-resource-name>Solr authenticated application</web-resource-name>

      <realm-name>Test Realm</realm-name>

4) Create new file /example/etc/

    guest: guest, core1-role
5) Start the server and verfiy on http://localhost:8983/solr/. You will get the following screen to input the credentials (Fig. 1)

    java -jar start.jar


6) Configuring the SolrJ to create connection with the Solr Server using Basic
Authentication Realm:

CommonsHttpSolrServer solr = new CommonsHttpSolrServer("http://localhost:8983/solr");
Credentials defaultcreds = new UsernamePasswordCredentials("guest", "guest");
solr.getHttpClient().getState().setCredentials(new AuthScope("localhost", 8983,
AuthScope.ANY_REALM), defaultcreds);
Categories: , , , , ,


Post a Comment

Find me on Facebook! Follow me on Twitter!