Hi All,
We are upgrading from solr 4 to solr 8. Updated the solr server to solr8.8.2,
solrj8.8.2.
We are trying to resume the code and in one place where we are trying to get a
collection from clusterstate. Code used is as below
Clusterstate clusterState = null;
For(SearchSolrZookeeper zk:livezks){
SolrZkClient zkClient = null;
ZKStateReader stateReader = null;
Try{
Zkclient = new SolrZkClient(zk.getUrl(), 3000);
stateReader = new ZKStateReader(Zkclient);
stateReader.createClusterStateWatchersAndUpdate();
clusterState = stateReader.getClusterState();
Connected = true;
Exception = null;
break;
}
Catch(){
}
Finally{
State reader.close();
Zkclient.close();
}
If(clusterstate!=null){
Doccollection dc = clusterstate.getCollection(“INVOICE”);
//here dc is null
}
}
Tried using getcollectionornull - returns null
Getcollectionornull(collection name, true) — returns null
When I debug I can see clusterstate has below values in it
Znodeversion:0
Live node:[192.123.33.44:3883_Solr,
192.123.33.44:9883_Solr,192.123.33.45:3883_Solr,192.123.33.45:3883_Solr]
Collections:{ORDER=LazyCollectionRef(ORDER), INVOICE=
LazyCollectionRef(INVOICE), PAYMENT= LazyCollectionRef(PAYMENT),etc..}
From the document collection we get the slices and iterate each replica to show
the cores in a admin page. But this page worked fine with the code in solr4,
now with solr8 it throws error. Kindly help.
Regards
Reej