On 11/21/2013 1:57 AM, RadhaJayalakshmi wrote:
Hi,I am using solr4.4 with zookeeper 3.3.5. While i was checking for error conditions of my application, i came across a strange issue.Here is what i tried:I have three fields defined in my schemaa) UNIQUE_KEY - of type solr.TrieLongb) empId - of type Solr.TrieLongc) companyId - of type Solr.TrieLongHow Am i Indexing:----------------------------I am indexing using SolrJ API. and the data for the indexing will be in a text file, delimited by | symbol. My Indexer java program will read the textfile lineby line, splits the data by | symbol and creates SolrInputdocument object (for every line of the file) and adds the fields with values (that it read from the file)Now, intentionally, in the data file, for unique_key, i had String values(instead of long value) . something like123AB|111|222Now, when i index this data, i am getting the below exception:*org.apache.solr.client.solrj.SolrServerException*: No live SolrServers available to handle this request*:[URL of my application]* at org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.java:333) at org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:318) at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117) at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:68) at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54) Caused by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Server at *[URL of my application] *returned non ok status:500, message:Internal Server Error at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:385) at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180) at org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.java:264) But, when i correct the unique_key field data, but when i gave string data for other two long fields, i am getting a different exceptionorg.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: ERROR: [Error stating the field name for which it is mismathing]orrg.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:424) at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180) at org.apache.solr.client.solrj.impl.LBHttpSolrServer.request(LBHttpSolrServer.java:264) at org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:318) at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117) at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:68) at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54) at What is my question here:--------------------------During indexing, if solr finds, that for any field, if the fieldtype declared in schema is mismatching with the data that is being givem, then it should riase the same type of exception.But in the above case, if it finds a mismatch for Unique_key, it is raising SolrServerException. For all other fields, it is raising, RemoteSolrException(which is an unchecked exception). Is this a bug in solr or is there any reason for thowing different exception for the above two cases.Expecting a positive replyThanksRadha
The first exception is an error thrown directly from SolrJ. It was unable to find any server to deal with the request, so it threw its own SolrServerException wrapping the last RemoteSolrException (HTTP error 500) it received.
The second exception happened in a different place. In this case, the request made it past the server-side uniqueKey handling code and into the code that handles other fields, which froim what I can see here returns a different error message and possibly a different HTTP code. Because it was different, SolrJ sent the RemoteSolrException up the chain to your application rather than catching and wrapping it in SolrServerException.
I am not surprised to hear that you get a different error for invalid data in the uniqueKey field than you do in other fields. Because of its nature, it must be handled in a different code path.
Thanks, Shawn