Hi,

Teamsite product uses solr from version 7.x and has been upgrading to version 
8.11.2 with no issues. However, when we tried to upgrade to solr 9, we are 
seeing many issues with compilation due to package structure changes/class 
removals/internal method implementation changes, etc.
We changed our configuration files and made code changes to fix these 
compilation issues but facing issues with the below code change.

Teamsite code using solr:


builder = new CloudSolrClient
        .Builder(Collections.singletonList(mServerDetails.getZookeeperUrl()), 
Optional.empty())
        .withHttpClient(getSecureClient());

private CloseableHttpClient getSecureClient() {
    CloseableHttpClient cHttpClient = null;
    try {
        TrustStrategy acceptingTrustStrategy = (cert, authType) -> true;
        SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, 
acceptingTrustStrategy).build();
        SSLConnectionSocketFactory sslConnectionSocketFactory = new 
SSLConnectionSocketFactory(sslContext, new DefaultHostnameVerifier());
        Registry<ConnectionSocketFactory> socketFactoryRegistry = 
RegistryBuilder.<ConnectionSocketFactory>create().
                                                                  
register(SCHEMA_HTTPS, sslConnectionSocketFactory).build();
        BasicHttpClientConnectionManager connectionManager = new 
BasicHttpClientConnectionManager(socketFactoryRegistry);
        cHttpClient = 
HttpClients.custom().setSSLSocketFactory(sslConnectionSocketFactory).setConnectionManager(connectionManager).build();
    } catch(NoSuchAlgorithmException | KeyStoreException | 
KeyManagementException ex)
    {
        mLogger.atError().log("Processing httpclient failed.: {}", ex);
    }
    return cHttpClient;

Here while building solrCloudClient withHttpClient method was accepting the 
httpClient type parameter till now. However, the solr9 withHttpClient method 
accepts the Http2SolrClient type parameter.  The local build compilation is 
failing because of this typecast issue.
We tried to find an alternative code fix for this by trying many approaches but 
did not work. Could you please provide an alternative approach for this?

Also,
Teamsite implementation:

ZkClientClusterStateProvider zkClusterClient = new 
ZkClientClusterStateProvider(zookeeperURL);
try{
       zkClusterClient.uploadConfig(configFolder.toPath(), configName);
}

This was also throwing issue because of the method implementation change, So I 
changed the code like below,


SolrZkClient zkClient = new SolrZkClient(zookeeperURL, 300);
ZkConfigSetService zkConfigSet = new ZkConfigSetService(zkClient);

try

{
    zkConfigSet.uploadConfig(configName, configFolder.toPath());

}

Please let me know if this usage is valid, if not please let me know the 
alternative for this as well.


Thanks & Regards,
​Keerthi Turakapalli

Reply via email to