Tried again with an empty baseDir, and this time it's a different error. The
error is thrown during the execution of the line:
msc = new MiniSolrCloudCluster(2, Paths.get("testcluster"), jettyConfig);
Here is the full stack trace:
org.apache.solr.common.SolrException: java.util.concurrent.TimeoutException:
Could not connect to ZooKeeper 127.0.0.1:18015 within 45000 ms
at
org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:181)
at
org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:115)
at
org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:105)
at
org.apache.solr.cloud.MiniSolrCloudCluster.<init>(MiniSolrCloudCluster.java:197)
at
org.apache.solr.cloud.MiniSolrCloudCluster.<init>(MiniSolrCloudCluster.java:111)
at
com.gossinteractive.solr.TestMiniSolrCloudCluster.setup(TestMiniSolrCloudCluster.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.util.concurrent.TimeoutException: Could not connect to
ZooKeeper 127.0.0.1:18015 within 45000 ms
at
org.apache.solr.common.cloud.ConnectionManager.waitForConnected(ConnectionManager.java:228)
at
org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:173)
... 21 more
-----Original Message-----
From: Shawn Heisey [mailto:[email protected]]
Sent: 15 April 2016 21:01
To: [email protected]
Subject: Re: MiniSolrCloudCluster usage in solr 7.0.0
On 4/14/2016 8:32 AM, Rohana Rajapakse wrote:
> I have added few dependency jars into my project. There are no compilation
> errors or ClassNotFound exceptions, but Zookeeper exception "
> KeeperException$NodeExistsException: KeeperErrorCode = NodeExists for
> /solr/solr.xml ". My temporary solrHome folder has a solr.xml. No other
> files (solrconfig.xml , schema.xml) are provided. Thought it should start
> solr cloud server with defaults, but it doesn't. There are no other solr or
> zookeeper servers running on my machine.
I looked at SolrCloudTestCase to see how MiniSolrCloudCluster should be used,
then I wrote a little program and configured ivy to pull down
solr-test-framework from 6.0.0 (getting ivy to work right was an adventure!).
Based on what I found in SolrCloudTestCase, this is the code I wrote last
evening:
public class MiniSC
{
static JettyConfig jettyConfig = null;
static MiniSolrCloudCluster msc = null;
static CloudSolrClient client = null;
public static void main(String[] args) throws Exception
{
jettyConfig = JettyConfig.builder().setContext("/solr").build();
msc = new MiniSolrCloudCluster(2, Paths.get("testcluster"),
jettyConfig);
client = msc.getSolrClient();
client.close();
msc.shutdown();
}
}
At first, I saw the same exception you got ... but after a little while I
figured out that this is because I was running the program more than once
without deleting everything in the baseDir -- so the zookeeper server was
starting with an existing database already containing the solr.xml. When
MiniSolrCloudCluster is used in Solr tests, the baseDir is newly created for
each test class, so this doesn't happen.
When I delete everything in "testcluster" and run my test code, I get the
following in my logfile:
http://apaste.info/Dkw
There are no errors, only WARN and INFO logs. At this point, I should be able
to use the client object to upload a config to zookeeper, create a collection,
and do other testing.
Thanks,
Shawn
Registered Office: 24 Darklake View, Estover, Plymouth, PL6 7TL.
Company Registration No: 3553908
This email contains proprietary information, some or all of which may be
legally privileged. It is for the intended recipient only. If an addressing or
transmission error has misdirected this email, please notify the author by
replying to this email. If you are not the intended recipient you may not use,
disclose, distribute, copy, print or rely on this email.
Email transmission cannot be guaranteed to be secure or error free, as
information may be intercepted, corrupted, lost, destroyed, arrive late or
incomplete or contain viruses. This email and any files attached to it have
been checked with virus detection software before transmission. You should
nonetheless carry out your own virus check before opening any attachment. GOSS
Interactive Ltd accepts no liability for any loss or damage that may be caused
by software viruses.