CloudSolrClient Sesion

2019-05-22 Thread Rainman Sián
Hello all,

I'm writing a Solr solution for a quite big project. To do so, I wrote an
OSGi service that provides the add/delete/query functionalities to Solr.

It works just fine, but we have a kind of Session issues along logs
increasing size on server due that the application servers throws this
exception

java.lang.NoClassDefFoundError: org/apache/zookeeper/proto/SetWatches
   at
org.apache.zookeeper.ClientCnxn$SendThread.primeConnection(ClientCnxn.java:926)
[com.servicenow.aem.servicenow-www-services:1.0.0.SNAPSHOT]
   at
org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:363)
[com.servicenow.aem.servicenow-www-services:1.0.0.SNAPSHOT]
   at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
[com.servicenow.aem.servicenow-www-services:1.0.0.SNAPSHOT]
20.05.2019 16:46:56.463 *INFO* [OsgiInstallerImpl-SendThread(X.X.X.X:2181)]
org.apache.zookeeper.ClientCnxn Socket connection established to
X.X.X.X/X.X.X.X:2181, initiating session
20.05.2019 16:46:56.463 *WARN* [OsgiInstallerImpl-SendThread(X.X.X.X:2181)]
org.apache.zookeeper.ClientCnxn Session 0x1003941f01c0a87 for server
X.X.X.X/X.X.X.X:2181, unexpected error, closing socket connection and
attempting reconnect

* I replaced X.X.X.X for the valid public IP we have

I have googled for this exception with no much luck, I can figure out what
is the root cause of this exception. I have to mention that this doesn't
happens always. but when it starts it just doesn't stop until we restart
the server. also all the Solr functionality keeps working just fine is just
that some server functionalities stops working and the amount of logs it
generates the issue.

Here is the code that I have, as you can see I only have on instance of
SolrClient, and I don't close the session so I don't have to create a new
SolrClient every time (at least that is the idea).


@Component(...)
@Service(...)
public class SolrAPIServiceImpl implements SolrAPIService {


private CloudSolrClient solrClient;

@Reference
private SolrConfigurationService solrConfigurationService;

@Activate
@Modified
protected void activate(final ComponentContext context) {
solrClient = new CloudSolrClient.Builder(Arrays.asList(
solrConfigurationService.getZookeeperHost().split(",")), Optional.empty()).
build();
solrClient.setZkConnectTimeout(solrConfigurationService.
getConnectionTimeoutMs());
solrClient.setZkClientTimeout(solrConfigurationService.getClientTimeoutMs
());
solrClient.setDefaultCollection(solrConfigurationService.getCollectionName
());

}

public void addOrUpdate(List docs) throws Exception {
if (docs.size() > 0) {
solrClient.addBeans(docs, solrConfigurationService.getCommitWithinMs());
}
}

public void addOrUpdate(SchemaObject doc) throws Exception {
solrClient.addBean(doc, solrConfigurationService.getCommitWithinMs());
}

public void deleteAll() throws Exception {
solrClient.deleteByQuery("*:*", solrConfigurationService.getCommitWithinMs
());
}

public void deleteById(String id) throws Exception {
solrClient.deleteById(id, solrConfigurationService.getCommitWithinMs());
}

public void delete(ServiceNowSchemaObject doc) throws Exception {
deleteById(doc.id);
}


public void deleteByQuery(String query) throws Exception {
solrClient.deleteByQuery(query, solrConfigurationService.getCommitWithinMs
());
}

}


Mailing List Subscription

2018-06-25 Thread Rainman Sián
Hello

I'm Rainman, I have worked with Solr in a couple of projects in the past
and about to start a new one.

I want to be part of this list and collaborate to the project,

Best regards,

--
Rainman Sián