org.apache.solr.client.solrj.SolrServerException: Error executing query
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:95)
at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:118)
at com.test.solr.TestSolr.main(TestSolr.java:35)
Caused by: java.lang.RuntimeException: Invalid version or the data in not in 'javabin' format
at org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:99)
at org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:39)
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:466)
at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:243)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)
... 2 more
代码:
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
import org.apache.solr.client.solrj.response.FacetField;
import org.apache.solr.client.solrj.response.FacetField.Count;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.params.FacetParams;
import org.nlc.ndlc.copyright.domain.TempProduct;
public class TestSolr {
public static void main(String[] args) {
try {
CommonsHttpSolrServer solrServer = new CommonsHttpSolrServer ("http://61.233.30.69:8080/solr");
SolrQuery sq = new SolrQuery();
sq.set("explainOther", "on");
sq.set("wt", "json");
sq.set("rows", "20");
sq.set("version", "2.2");
sq.set("fl", "tempproduct.id_l");
sq.set("q","tempproduct.taskid_t:1921");
sq.set( "facet" , "true");
sq.set("facet.field", "tempproduct.title_s");
sq.set("facet.field", "tempproduct.name_s");
sq.set("qt", "");
sq.set("fq", "");
QueryResponse qr= solrServer.query(sq);
SolrDocumentList sdl= qr.getResults();
for (SolrDocument solrDocument : sdl) {
SolrDocument ls = solrDocument;
System.out.println(ls.getFieldValues("tempproduct.id_l"));
}
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}
5 个解决方案
#1
#2
Could be a solrj .jar version compat issue. Check that the client and
server's solrj version jars match up.
客户端与服务端的solrj.jar的版本要一致哦~
http://lucene.472066.n3.nabble.com/SolrJ-Trunk-Invalid-version-or-the-data-in-not-in-javabin-format-td2384421.html
http://lucene.472066.n3.nabble.com/SolrJ-Trunk-Invalid-version-or-the-data-in-not-in-javabin-format-td2384421.html
没有认真找答案哦~
server's solrj version jars match up.
客户端与服务端的solrj.jar的版本要一致哦~
http://lucene.472066.n3.nabble.com/SolrJ-Trunk-Invalid-version-or-the-data-in-not-in-javabin-format-td2384421.html
http://lucene.472066.n3.nabble.com/SolrJ-Trunk-Invalid-version-or-the-data-in-not-in-javabin-format-td2384421.html
没有认真找答案哦~
#3
英文不太好。嘿嘿。谢谢啦。
#4
#5
#1
#2
Could be a solrj .jar version compat issue. Check that the client and
server's solrj version jars match up.
客户端与服务端的solrj.jar的版本要一致哦~
http://lucene.472066.n3.nabble.com/SolrJ-Trunk-Invalid-version-or-the-data-in-not-in-javabin-format-td2384421.html
http://lucene.472066.n3.nabble.com/SolrJ-Trunk-Invalid-version-or-the-data-in-not-in-javabin-format-td2384421.html
没有认真找答案哦~
server's solrj version jars match up.
客户端与服务端的solrj.jar的版本要一致哦~
http://lucene.472066.n3.nabble.com/SolrJ-Trunk-Invalid-version-or-the-data-in-not-in-javabin-format-td2384421.html
http://lucene.472066.n3.nabble.com/SolrJ-Trunk-Invalid-version-or-the-data-in-not-in-javabin-format-td2384421.html
没有认真找答案哦~
#3
英文不太好。嘿嘿。谢谢啦。