lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Qin <>
Subject SolrJ cannot get actual cause of error
Date Sat, 29 Sep 2018 09:08:07 GMT
Hi there,

I'm working on a project which uses solr as search engine. I found I cannot get the root cause
of error from SolrJ.

Case 1
I try to create a field with wrong field type

        Map<String, Object> fieldd = new LinkedHashMap<String, Object>();
        fieldd.put("name", "eeeee");
        fieldd.put("type", "srting");
        fieldd.put("stored", true);
        fieldd.put("indexed", true);

        SchemaRequest.AddField addFieldRequest = new SchemaRequest.AddField(fieldd);
        addFieldRequest.process(client, "gettingstarted");

The exception I got is like:

1167 [main] ERROR org.apache.solr.client.solrj.impl.CloudSolrClient - Request to collection
[gettingstarted] failed due to (400) org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteExecutionException:
Error from server at error processing commands,
retry? 0

The root cause is wrapped very deep, like:


Case 2

I try to get an non-existence field.

        SchemaRequest.Field request = new SchemaRequest.Field("noexistfield");
        FieldResponse response = request.process(client, "gettingstarted");

The error message is like

No live SolrServers available to handle this request:[,]

Many other errors have the same problems. I have to do a lot pre-checking in code to get the
actual reason, which is very inconvenient and affects performance. Coud Solr provide a method
to get the real cause easily, like "getRootCause()" in SolrJ? Thanks!

Best Regards,

  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message