Created 04-06-2017 11:18 AM
I am trying to index some data using Solrj. I have a very simple Solrj program:
---------------
public static void main(final String[] args) throws SolrServerException, IOException {
final String zkHostString = "dwh-mst-dev01.stor.nccourts.org:2181/solr,dwh-mst-dev02.stor.nccourts.org:2181/solr,dwh-mst-dev03.stor.nccourts.org:2181/solr";
final CloudSolrServer solr = new CloudSolrServer(zkHostString);
final UpdateRequest request = new UpdateRequest();
request.setAction(UpdateRequest.ACTION.COMMIT, true, true);
request.setParam("collection", "party_name");
final SolrInputDocument doc = new SolrInputDocument();
final List<String> records = SolrJPopulater.loadSampleData();
for (final String record : records) {
final String[] fields = record.split(",");
doc.addField("id", fields[0]);
doc.addField("county", fields[1]);
doc.addField("year", Integer.parseInt(fields[2]));
doc.addField("court_type", fields[3]);
doc.addField("seq_num", Integer.parseInt(fields[4]));
doc.addField("party_role", fields[5]);
doc.addField("party_num", Integer.parseInt(fields[6]));
doc.addField("party_status", fields[7]);
doc.addField("biz_name", fields[8]);
doc.addField("prefix", fields[9]);
doc.addField("last_name", fields[10]);
doc.addField("first_name", fields[11]);
doc.addField("middle_name", fields[12]);
doc.addField("suffix", fields[13]);
doc.addField("in_regards_to", fields[14]);
doc.addField("case_status", fields[15]);
doc.addField("row_of_origin", fields[16]);
final UpdateResponse response = solr.add(doc);
System.out.println("status code=" + response.getStatus());
}
solr.commit();
}
The error is happening at this line:
if (zk != null) zk.close();
-->> throw new ZooKeeperException(SolrException.ErrorCode.SERVER_ERROR,
"", e);
Below is the full trace.
Thanks
--------------
2017-04-06 13:33:19,057 INFO main.logEnv - Client environment:user.dir=C:\cygwin\home\iapima\git\aoc-data-lake-hadoop
2017-04-06 13:33:19,059 INFO main.<init> - Initiating client connection, connectString=dwh-mst-dev01.stor.nccourts.org:2181/solr,dwh-mst-dev02.stor.nccourts.org:2181/solr,dwh-mst-dev03.stor.nccourts.org:2181/solr sessionTimeout=10000 watcher=org.apache.solr.common.cloud.ConnectionManager@18ef96
2017-04-06 13:33:19,067 DEBUG main.<clinit> - zookeeper.disableAutoWatchReset is false
2017-04-06 13:33:19,178 INFO main.waitForConnected - Waiting for client to connect to ZooKeeper
2017-04-06 13:33:19,183 INFO main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).logStartConnect - Opening socket connection to server dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181. Will not attempt to authenticate using SASL (unknown error)
2017-04-06 13:33:19,185 INFO main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).primeConnection - Socket connection established to dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181, initiating session
2017-04-06 13:33:19,187 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).primeConnection - Session establishment request sent on dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181
2017-04-06 13:33:19,203 INFO main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).onConnected - Session establishment complete on server dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181, sessionid = 0x15ad7740271bb85, negotiated timeout = 10000
2017-04-06 13:33:19,205 INFO main-EventThread.process - Watcher org.apache.solr.common.cloud.ConnectionManager@18ef96 name:ZooKeeperConnection Watcher:dwh-mst-dev01.stor.nccourts.org:2181/solr,dwh-mst-dev02.stor.nccourts.org:2181/solr,dwh-mst-dev03.stor.nccourts.org:2181/solr got event WatchedEvent state:SyncConnected type:None path:null path:null type:None
2017-04-06 13:33:19,206 INFO main.waitForConnected - Client is connected to ZooKeeper
2017-04-06 13:33:19,206 INFO main.createZkACLProvider - Using default ZkACLProvider
2017-04-06 13:33:19,220 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740271bb85, packet:: clientPath:null serverPath:null finished:false header:: 1,3 replyHeader:: 1,55835606662,-101 request:: '/solr%2Cdwh-mst-dev02.stor.nccourts.org:2181/solr%2Cdwh-mst-dev03.stor.nccourts.org:2181/solr/clusterstate.json,F response::
2017-04-06 13:33:19,223 INFO main.makePath - makePath: /clusterstate.json
2017-04-06 13:33:19,226 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740271bb85, packet:: clientPath:null serverPath:null finished:false header:: 2,3 replyHeader:: 2,55835606662,-101 request:: '/solr%2Cdwh-mst-dev02.stor.nccourts.org:2181/solr%2Cdwh-mst-dev03.stor.nccourts.org:2181/solr/clusterstate.json,F response::
2017-04-06 13:33:19,349 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740271bb85, packet:: clientPath:null serverPath:null finished:false header:: 3,1 replyHeader:: 3,55835606663,-101 request:: '/solr%2Cdwh-mst-dev02.stor.nccourts.org:2181/solr%2Cdwh-mst-dev03.stor.nccourts.org:2181/solr/clusterstate.json,,v{s{31,s{'world,'anyone}}},0 response::
2017-04-06 13:33:19,353 DEBUG main.close - Closing session: 0x15ad7740271bb85
2017-04-06 13:33:19,354 DEBUG main.close - Closing client for session: 0x15ad7740271bb85
2017-04-06 13:33:19,362 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740271bb85, packet:: clientPath:null serverPath:null finished:false header:: 4,-11 replyHeader:: 4,55835606664,0 request:: null response:: null
2017-04-06 13:33:19,363 DEBUG main.disconnect - Disconnecting client for session: 0x15ad7740271bb85
2017-04-06 13:33:19,363 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).run - An exception was thrown while closing send thread for session 0x15ad7740271bb85 : Unable to read additional data from server sessionid 0x15ad7740271bb85, likely server has closed socket
2017-04-06 13:33:19,363 INFO main-EventThread.run - EventThread shut down
2017-04-06 13:33:19,363 INFO main.close - Session: 0x15ad7740271bb85 closed
Exception in thread "main" org.apache.solr.common.cloud.ZooKeeperException:
at org.apache.solr.client.solrj.impl.CloudSolrServer.connect(CloudSolrServer.java:270)
at org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:548)
at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:124)
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116)
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:102)
at org.nccourts.hadoop.solr.SolrJPopulater.main(SolrJPopulater.java:52)
Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /clusterstate.json
at org.apache.zookeeper.KeeperException.create(KeeperException.java:111)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783)
at org.apache.solr.common.cloud.SolrZkClient$10.execute(SolrZkClient.java:507)
at org.apache.solr.common.cloud.ZkCmdExecutor.retryOperation(ZkCmdExecutor.java:61)
at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:504)
at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:461)
at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:448)
at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:435)
at org.apache.solr.common.cloud.ZkCmdExecutor.ensureExists(ZkCmdExecutor.java:94)
at org.apache.solr.common.cloud.ZkCmdExecutor.ensureExists(ZkCmdExecutor.java:84)
at org.apache.solr.common.cloud.ZkStateReader.createClusterStateWatchersAndUpdate(ZkStateReader.java:295)
at org.apache.solr.client.solrj.impl.CloudSolrServer.connect(CloudSolrServer.java:261)
... 5 more
Created 04-10-2017 03:25 PM
Created 04-11-2017 04:35 AM
My post includes my entire code. This line of code: if (zk != null) zk.close(); is not in my code. Thats where the error is happening. I happend to know that because I downloaded the source code.
This is my code:
------
public static void main(final String[] args) throws SolrServerException, IOException {
final String zkHostString = "dwh-mst-dev01.stor.nccourts.org:2181/solr,dwh-mst-dev02.stor.nccourts.org:2181/solr,dwh-mst-dev03.stor.nccourts.org:2181/solr";
final CloudSolrServer solr = new CloudSolrServer(zkHostString);
final UpdateRequest request = new UpdateRequest();
request.setAction(UpdateRequest.ACTION.COMMIT, true, true);
request.setParam("collection", "party_name");
final SolrInputDocument doc = new SolrInputDocument();
final List<String> records = SolrJPopulater.loadSampleData();
for (final String record : records) {
final String[] fields = record.split(",");
doc.addField("id", fields[0]);
doc.addField("county", fields[1]);
doc.addField("year", Integer.parseInt(fields[2]));
doc.addField("court_type", fields[3]);
doc.addField("seq_num", Integer.parseInt(fields[4]));
doc.addField("party_role", fields[5]);
doc.addField("party_num", Integer.parseInt(fields[6]));
doc.addField("party_status", fields[7]);
doc.addField("biz_name", fields[8]);
doc.addField("prefix", fields[9]);
doc.addField("last_name", fields[10]);
doc.addField("first_name", fields[11]);
doc.addField("middle_name", fields[12]);
doc.addField("suffix", fields[13]);
doc.addField("in_regards_to", fields[14]);
doc.addField("case_status", fields[15]);
doc.addField("row_of_origin", fields[16]);
final UpdateResponse response = solr.add(doc);
System.out.println("status code=" + response.getStatus());
}
solr.commit();
}
Created 04-11-2017 05:38 AM
I also received a similar exception when trying to query my collection:
2017-04-11 08:28:36,967 INFO main.waitForConnected - Waiting for client to connect to ZooKeeper
2017-04-11 08:28:37,004 INFO main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).logStartConnect - Opening socket connection to server dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181. Will not attempt to authenticate using SASL (unknown error)
2017-04-11 08:28:37,031 INFO main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).primeConnection - Socket connection established to dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181, initiating session
2017-04-11 08:28:37,035 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).primeConnection - Session establishment request sent on dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181
2017-04-11 08:28:37,074 INFO main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).onConnected - Session establishment complete on server dwh-mst-dev01.stor.nccourts.org/10.91.62.104:2181, sessionid = 0x15ad7740272589b, negotiated timeout = 10000
2017-04-11 08:28:37,091 INFO main-EventThread.process - Watcher org.apache.solr.common.cloud.ConnectionManager@18ef96 name:ZooKeeperConnection Watcher:dwh-mst-dev01.stor.nccourts.org:2181/solr,dwh-mst-dev02.stor.nccourts.org:2181/solr,dwh-mst-dev03.stor.nccourts.org:2181/solr got event WatchedEvent state:SyncConnected type:None path:null path:null type:None
2017-04-11 08:28:37,093 INFO main.waitForConnected - Client is connected to ZooKeeper
2017-04-11 08:28:37,094 INFO main.createZkACLProvider - Using default ZkACLProvider
2017-04-11 08:28:37,132 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740272589b, packet:: clientPath:null serverPath:null finished:false header:: 1,3 replyHeader:: 1,55835836011,-101 request:: '/solr%2Cdwh-mst-dev02.stor.nccourts.org:2181/solr%2Cdwh-mst-dev03.stor.nccourts.org:2181/solr/clusterstate.json,F response::
2017-04-11 08:28:37,136 INFO main.makePath - makePath: /clusterstate.json
2017-04-11 08:28:37,162 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740272589b, packet:: clientPath:null serverPath:null finished:false header:: 2,3 replyHeader:: 2,55835836011,-101 request:: '/solr%2Cdwh-mst-dev02.stor.nccourts.org:2181/solr%2Cdwh-mst-dev03.stor.nccourts.org:2181/solr/clusterstate.json,F response::
2017-04-11 08:28:37,199 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740272589b, packet:: clientPath:null serverPath:null finished:false header:: 3,1 replyHeader:: 3,55835836012,-101 request:: '/solr%2Cdwh-mst-dev02.stor.nccourts.org:2181/solr%2Cdwh-mst-dev03.stor.nccourts.org:2181/solr/clusterstate.json,,v{s{31,s{'world,'anyone}}},0 response::
2017-04-11 08:28:37,209 DEBUG main.close - Closing session: 0x15ad7740272589b
2017-04-11 08:28:37,210 DEBUG main.close - Closing client for session: 0x15ad7740272589b
2017-04-11 08:28:37,238 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).readResponse - Reading reply sessionid:0x15ad7740272589b, packet:: clientPath:null serverPath:null finished:false header:: 4,-11 replyHeader:: 4,55835836013,0 request:: null response:: null
2017-04-11 08:28:37,239 DEBUG main-SendThread(dwh-mst-dev01.stor.nccourts.org:2181).run - An exception was thrown while closing send thread for session 0x15ad7740272589b : Unable to read additional data from server sessionid 0x15ad7740272589b, likely server has closed socket
2017-04-11 08:28:37,240 DEBUG main.disconnect - Disconnecting client for session: 0x15ad7740272589b
2017-04-11 08:28:37,241 INFO main.close - Session: 0x15ad7740272589b closed
2017-04-11 08:28:37,241 INFO main-EventThread.run - EventThread shut down
Exception in thread "main" org.apache.solr.common.cloud.ZooKeeperException:
at org.apache.solr.client.solrj.impl.CloudSolrServer.connect(CloudSolrServer.java:270)
at org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:548)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:91)
at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
at org.nccourts.hadoop.solrj.SolrjQuery.getResults(SolrjQuery.java:34)
at org.nccourts.hadoop.solrj.SolrjQuery.main(SolrjQuery.java:22)
Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /clusterstate.json
at org.apache.zookeeper.KeeperException.create(KeeperException.java:111)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783)
at org.apache.solr.common.cloud.SolrZkClient$10.execute(SolrZkClient.java:507)
at org.apache.solr.common.cloud.ZkCmdExecutor.retryOperation(ZkCmdExecutor.java:61)
at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:504)
at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:461)
at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:448)
at org.apache.solr.common.cloud.SolrZkClient.makePath(SolrZkClient.java:435)
at org.apache.solr.common.cloud.ZkCmdExecutor.ensureExists(ZkCmdExecutor.java:94)
at org.apache.solr.common.cloud.ZkCmdExecutor.ensureExists(ZkCmdExecutor.java:84)
at org.apache.solr.common.cloud.ZkStateReader.createClusterStateWatchersAndUpdate(ZkStateReader.java:295)
at org.apache.solr.client.solrj.impl.CloudSolrServer.connect(CloudSolrServer.java:261)
... 5 more
My program is very simple:
---
public class SolrjQuery {
public static void main(final String[] args) throws SolrServerException, IOException {
final String zkHostString = "dwh-mst-dev01.stor.nccourts.org:2181/solr,dwh-mst-dev02.stor.nccourts.org:2181/solr,dwh-mst-dev03.stor.nccourts.org:2181/solr";
final CloudSolrServer solr = new CloudSolrServer(zkHostString);
solr.setDefaultCollection("party_name");
final SolrDocumentList docs = SolrjQuery.getResults(solr);
for (final SolrDocument doc : docs) {
System.out.println(doc);
}
}
static SolrDocumentList getResults(final CloudSolrServer server) {
final SolrQuery query = new SolrQuery();
query.setQuery("*:*");
QueryResponse rsp = null;
try {
rsp = server.query(query);
} catch (final SolrServerException e) {
e.printStackTrace();
return null;
}
final SolrDocumentList docs = rsp.getResults();
return docs;
}
}
---
Created 04-11-2017 06:05 AM
Hi imad87,
Your question looks related to Solr, so I think it may fit better into the "Search" community: http://community.cloudera.com/t5/Cloudera-Search-Apache-SolrCloud/bd-p/Search
Cheers, Lars
Created 04-11-2017 06:22 AM
I moved it for you. 🙂