title: Connect to a solr server with credential with solrj
body: <p>I'm trying to connect to a solr server using this code:</p>
  
  <pre><code>SolrServer solr = new HttpSolrServer("http://localhost:8080/solr-all");
  SolrQuery query = new SolrQuery();
  
  query.setQuery("*:*");
  query.setRows(10);
  query.setStart(0);
  
  QueryResponse response = solr.query(query);
  System.out.println(response);
  </code></pre>
  
  <p>but i get this error:</p>
  
  <pre><code>SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
  SLF4J: Defaulting to no-operation (NOP) logger implementation
  SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
  Exception in thread "main" org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Server at http://localhost:8080/solr-all returned non ok status:401, message:Unauthorized
  </code></pre>
  
  <p>i really don't know how to set the username and password, i found many exaples on the web using <code>htttpclient</code> but none of them worked for me.</p>