solrExc = new HttpSolrClient.RemoteSolrException(client.getBaseURL(), statusCode, msg.toString(), null); if (metadata != null) { solrExc.setMetadata(metadata);
default: if (processor == null || "".equals(contentType)) { throw new RemoteSolrException(baseUrl, httpStatus, "non ok status: " + httpStatus + ", message:" + response.getStatusLine().getReasonPhrase(), null); msg = msg + " " + IOUtils.toString(respBody, encoding); } catch (IOException e) { throw new RemoteSolrException(baseUrl, httpStatus, "Could not parse response with encoding " + encoding, e); throw new RemoteSolrException(baseUrl, httpStatus, msg, null); rsp = processor.processResponse(respBody, charset); } catch (Exception e) { throw new RemoteSolrException(baseUrl, httpStatus, e.getMessage(), e); reason = java.net.URLDecoder.decode(msg.toString(), UTF_8); RemoteSolrException rss = new RemoteSolrException(baseUrl, httpStatus, reason, null); if (metadata != null) rss.setMetadata(metadata); throw rss;
} catch (SolrServerException | RemoteSolrException | IOException e) { if (e instanceof RemoteSolrException && ((RemoteSolrException)e).code()==400) { log.warn("LISTALIASES not found, possibly using older Solr server. Aliases won't work" + " unless you re-create the CloudSolrClient using zkHost(s) or upgrade Solr server", e);
queryResponse = solrServer.query(solrQuery); } catch (RemoteSolrException ex) { String messageFromSolr = ex.getLocalizedMessage(); String error = "Search Syntax Error: "; String stringToHide = "org.apache.solr.search.SyntaxError: ";
default: if (processor == null || "".equals(contentType)) { throw new RemoteSolrException(baseUrl, httpStatus, "non ok status: " + httpStatus + ", message:" + response.getStatusLine().getReasonPhrase(), null); msg = msg + " " + IOUtils.toString(respBody, encoding); } catch (IOException e) { throw new RemoteSolrException(baseUrl, httpStatus, "Could not parse response with encoding " + encoding, e); throw new RemoteSolrException(baseUrl, httpStatus, msg, null); rsp = processor.processResponse(respBody, charset); } catch (Exception e) { throw new RemoteSolrException(baseUrl, httpStatus, e.getMessage(), e); reason = java.net.URLDecoder.decode(msg.toString(), UTF_8); RemoteSolrException rss = new RemoteSolrException(baseUrl, httpStatus, reason, null); if (metadata != null) rss.setMetadata(metadata); throw rss;
return true; } catch (HttpSolrClient.RemoteSolrException e) { log.warn("Error updating document [{}]: [{}]", finalDoc.getFieldValue(ID),e.getMessage(), e); return false;
queryResponse = getSolrServer().query(solrQuery); } catch (RemoteSolrException ex) { String messageFromSolr = ex.getLocalizedMessage(); String error = "Search Syntax Error: "; String stringToHide = "org.apache.solr.search.SyntaxError: ";
assertTrue( DEFAULT_RETRY_PREDICATE.test( new HttpSolrClient.RemoteSolrException( "localhost", SolrException.ErrorCode.SERVICE_UNAVAILABLE.code,
@Override public CollectionRef getState(String collection) { for (String nodeName: liveNodes) { try (HttpSolrClient client = new HttpSolrClient.Builder(). withBaseSolrUrl(Utils.getBaseUrlForNodeName(nodeName, urlScheme)). withHttpClient(httpClient).build()) { ClusterState cs = fetchClusterState(client, collection, null); return cs.getCollectionRef(collection); } catch (SolrServerException | IOException e) { log.warn("Attempt to fetch cluster state from " + Utils.getBaseUrlForNodeName(nodeName, urlScheme) + " failed.", e); } catch (RemoteSolrException e) { if ("NOT_FOUND".equals(e.getMetadata("CLUSTERSTATUS"))) { return null; } log.warn("Attempt to fetch cluster state from " + Utils.getBaseUrlForNodeName(nodeName, urlScheme) + " failed.", e); } catch (NotACollectionException e) { // Cluster state for the given collection was not found, could be an alias. // Lets fetch/update our aliases: getAliases(true); return null; } } throw new RuntimeException("Tried fetching cluster state using the node names we knew of, i.e. " + liveNodes +". However, " + "succeeded in obtaining the cluster state from none of them." + "If you think your Solr cluster is up and is accessible," + " you could try re-creating a new CloudSolrClient using working" + " solrUrl(s) or zkHost(s)."); }