Minor refactor to make it easier to debug OAI Solr connection problems. Update to new config format

This commit is contained in:
Tim Donohue
2020-02-24 10:35:14 -06:00
parent 8cceea8f06
commit d78f3c393b
2 changed files with 8 additions and 7 deletions

View File

@@ -26,11 +26,12 @@ public class DSpaceSolrServerResolver implements SolrServerResolver {
@Override @Override
public SolrClient getServer() throws SolrServerException { public SolrClient getServer() throws SolrServerException {
if (server == null) { if (server == null) {
String serverUrl = configurationService.getProperty("oai.solr.url");
try { try {
server = new HttpSolrClient.Builder(configurationService.getProperty("oai", "solr.url")).build(); server = new HttpSolrClient.Builder(serverUrl).build();
log.debug("Solr Server Initialized"); log.debug("OAI Solr Server Initialized");
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error("Could not initialize OAI Solr Server at " + serverUrl , e);
} }
} }
return server; return server;

View File

@@ -30,12 +30,12 @@ public class DSpaceSolrServer {
public static SolrClient getServer() throws SolrServerException { public static SolrClient getServer() throws SolrServerException {
if (_server == null) { if (_server == null) {
String serverUrl = ConfigurationManager.getProperty("oai.solr.url");
try { try {
_server = new HttpSolrClient.Builder( _server = new HttpSolrClient.Builder(serverUrl).build();
ConfigurationManager.getProperty("oai", "solr.url")).build(); log.debug("OAI Solr Server Initialized");
log.debug("Solr Server Initialized");
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error("Could not initialize OAI Solr Server at " + serverUrl , e);
} }
} }
return _server; return _server;