Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Solr - SASL configuration failed. Will continue connection to Zookeeper server without SASL authentication, if Zookeeper server allows it

avatar
New Contributor

"message":"Could not login: the Client is being asked for a password, but the ZooKeeper Client code does not currently support obtaining a password from the user. Make sure that the Client is configured to use a ticket cache (using the JAAS configuration setting 'useTicketCache=true)' and restart the Client. If you still get this message after that, the TGT in the ticket cache has expired and must be manually refreshed. To do so, first determine if you are using a password or a keytab. If the former, run kinit in a Unix shell in the environment of the user who is running this Zookeeper Client using the command 'kinit <princ>' (where <princ> is the name of the Client's Kerberos principal). If the latter, do 'kinit -k -t <keytab> <princ>' (where <princ> is the name of the Kerberos principal, and <keytab> is the location of the keytab file). After manually refreshing your cache, restart this Client. If you continue to see this message after manually refreshing your cache, ensure that your KDC host's clock is in sync with this host's clock."}
        [Krb5LoginModule] authentication failed
No password provided
{"ts":"2022-09-20T05:54:13.215-0500","level":"WARN","type":"Business","application":"match-api","thread":"main,"logger":"org.apache.zookeeper.ClientCnxn","message":"SASL configuration failed. Will continue connection to Zookeeper server without SASL authentication, if Zookeeper server allows it.","stack_trace":"javax.security.auth.login.LoginException: No password provided\r\n\tat jdk.security.auth/com.sun.security.auth.module.Krb5LoginModule.promptForPass(Krb5LoginModule.java:899)\r\n\tat jdk.security.auth/com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:740)\r\n\tat jdk.security.auth/com.sun.security.auth.module.Krb5LoginModule.login(Krb5LoginModule.java:592)\r\n\tat java.base/javax.security.auth.login.LoginContext.invoke(LoginContext.java:747)\r\n\tat java.base/javax.security.auth.login.LoginContext$4.run(LoginContext.java:672)\r\n\tat java.base/javax.security.auth.login.LoginContext$4.run(LoginContext.java:670)\r\n\tat java.base/java.security.AccessController.doPrivileged(Native Method)\r\n\tat java.base/javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:670)\r\n\tat java.base/javax.security.auth.login.LoginContext.login(LoginContext.java:581)\r\n\tat org.apache.zookeeper.Login.login(Login.java:319)\r\n\tat org.apache.zookeeper.Login.<init>(Login.java:103)\r\n\tat org.apache.zookeeper.client.ZooKeeperSaslClient.createSaslClient(ZooKeeperSaslClient.java:245)\r\n\tat org.apache.zookeeper.client.ZooKeeperSaslClient.<init>(ZooKeeperSaslClient.java:139)\r\n\tat org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1147)\r\n\tat org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1195)\r\n"}

 

 

Facing issue while connecting to Solr from the local machine

1 REPLY 1

avatar
New Contributor

System.setProperty("java.security.auth.login.config", "C:\\my_jaas.conf");

System.setProperty("java.security.krb5.conf", "C:\\krb5.conf");

String zkHosts = "zookeeper1.com:2181,zookeeper2.ghp.com:2181,zookeeper3.ghp.com:2181/solr";

Krb5HttpClientBuilder krbBuild = new Krb5HttpClientBuilder();
SolrHttpClientBuilder kb = krbBuild.getBuilder();
HttpClientUtil.setHttpClientBuilder(kb);
CloudSolrClient solrServer = new CloudSolrClient.Builder().withZkHost(zkHosts).build();

String collectionName = "test_col";
solrServer.setDefaultCollection(collectionName);
solrServer.connect();

SolrQuery parameters = new SolrQuery();
parameters.set("q", "*:*");
try {
solrServer.commit();
QueryResponse response = solrServer.query(parameters);
for (SolrDocument solrDocument : response.getResults()) {
System.out.println(" " + solrDocument.toString());
}
krbBuild.close();
solrServer.close();
} catch (SolrServerException | IOException e) {
e.printStackTrace();
}

 

 

implemented code