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 http://10.0.75.1:7574/solr/gettingstarted: error 
processing commands, retry? 0

The root cause is wrapped very deep, like:

[cid:image001.png@01D45816.599C3040]

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:[http://10.0.75.1:7574/solr/gettingstarted, 
http://10.0.75.1:8983/solr/gettingstarted]


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,
Ryan

Reply via email to