Thanks for Shawn Heisey and Chris Hostetter for your support. Finally I got it working. As you both pointed out, for the time being, I will start with an empty baseDir.
Best, Rohana -----Original Message----- From: Rohana Rajapakse [mailto:rohana.rajapa...@gossinteractive.com] Sent: 19 April 2016 12:01 To: solr-user@lucene.apache.org Subject: RE: MiniSolrCloudCluster usage in solr 7.0.0 Found the missing CloudSolrClient ::Builder class in the master branch, and the code goes a bit further now. Still Solr cloud is not starting up. It is failing to register Solr servers with Zookeeper. Here is the stack trace: java.lang.IllegalStateException: Solr servers failed to register with ZK. Current count: 0; Expected count: 1 at org.apache.solr.cloud.MiniSolrCloudCluster.<init>(MiniSolrCloudCluster.java:240) 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.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) And her is the log file content: 11:51:19,688 INFO ~ STARTING ZK TEST SERVER 11:51:19,690 INFO ~ client port:0.0.0.0/0.0.0.0:0 11:51:19,690 INFO ~ Starting server 11:51:19,727 INFO ~ Server environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT 11:51:19,727 INFO ~ Server environment:java.version=1.8.0_40 11:51:19,728 INFO ~ Server environment:user.dir=C:\projects\gossprojects\goss-typeahead-solr6\goss-typeahead-solrhandlers 11:51:19,739 INFO ~ Created server with tickTime 1000 minSessionTimeout 2000 maxSessionTimeout 20000 datadir C:\projects\gossprojects\goss-typeahead-solr6\goss-typeahead-solrhandlers\src\testdata\minicluster\zookeeper\server1\data\version-2 snapdir C:\projects\gossprojects\goss-typeahead-solr6\goss-typeahead-solrhandlers\src\testdata\minicluster\zookeeper\server1\data\version-2 11:51:19,815 INFO ~ binding to port 0.0.0.0/0.0.0.0:0 11:51:19,893 INFO ~ start zk server on port:42470 11:51:19,901 INFO ~ Using default ZkCredentialsProvider 11:51:19,909 INFO ~ Client environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT 11:51:19,910 INFO ~ Initiating client connection, connectString=127.0.0.1:42470 sessionTimeout=45000 watcher=org.apache.solr.common.cloud.SolrZkClient$3@52d455b8 11:51:19,922 INFO ~ Waiting for client to connect to ZooKeeper 11:51:19,924 INFO ~ Opening socket connection to server 127.0.0.1/127.0.0.1:42470. Will not attempt to authenticate using SASL (unknown error) 11:51:19,925 INFO ~ Socket connection established to 127.0.0.1/127.0.0.1:42470, initiating session 11:51:19,925 INFO ~ Accepted socket connection from /127.0.0.1:42474 11:51:19,930 INFO ~ Client attempting to establish new session at /127.0.0.1:42474 11:51:19,932 INFO ~ Creating new log file: log.1 11:51:19,957 INFO ~ Established session 0x1542e25578e0000 with negotiated timeout 20000 for client /127.0.0.1:42474 11:51:19,957 INFO ~ Session establishment complete on server 127.0.0.1/127.0.0.1:42470, sessionid = 0x1542e25578e0000, negotiated timeout = 20000 11:51:19,964 INFO ~ Watcher org.apache.solr.common.cloud.ConnectionManager@3d1ad5cc name:ZooKeeperConnection Watcher:127.0.0.1:42470 got event WatchedEvent state:SyncConnected type:None path:null path:null type:None 11:51:19,964 INFO ~ Client is connected to ZooKeeper 11:51:19,965 INFO ~ Using default ZkACLProvider 11:51:19,966 INFO ~ makePath: /solr/solr.xml 11:51:20,001 INFO ~ Processed session termination for sessionid: 0x1542e25578e0000 11:51:20,010 INFO ~ Session: 0x1542e25578e0000 closed 11:51:20,011 INFO ~ Closed socket connection for client /127.0.0.1:42474 which had sessionid 0x1542e25578e0000 11:51:20,012 INFO ~ EventThread shut down for session: 0x1542e25578e0000 11:51:20,024 INFO ~ Logging initialized @617ms 11:51:20,102 INFO ~ jetty-9.3.8.RC0 11:51:20,128 INFO ~ Started o.e.j.s.ServletContextHandler@5ccad1a7{/solr,null,AVAILABLE} 11:51:20,135 INFO ~ Started ServerConnector@5ba090a4{HTTP/1.1,[http/1.1]}{0.0.0.0:42475} 11:51:20,135 INFO ~ Started @728ms 11:51:20,135 INFO ~ Jetty properties: {hostContext=/solr, hostPort=42475} 11:51:20,141 INFO ~ SolrDispatchFilter.init(): sun.misc.Launcher$AppClassLoader@24d46ca6 11:51:20,159 INFO ~ new SolrResourceLoader for directory: 'C:\projects\gossprojects\goss-typeahead-solr6\goss-typeahead-solrhandlers\src\testdata\minicluster\node1' 11:51:20,162 INFO ~ JNDI not configured for solr (NoInitialContextEx) 11:51:20,162 INFO ~ solr home defaulted to 'solr/' (could not find system property or JNDI) 11:51:20,166 INFO ~ Using default ZkCredentialsProvider 11:51:20,166 INFO ~ Initiating client connection, connectString=127.0.0.1:42470/solr sessionTimeout=30000 watcher=org.apache.solr.common.cloud.SolrZkClient$3@298090c4 11:51:20,168 INFO ~ Waiting for client to connect to ZooKeeper 11:51:20,168 INFO ~ Opening socket connection to server 127.0.0.1/127.0.0.1:42470. Will not attempt to authenticate using SASL (unknown error) 11:51:20,168 INFO ~ Socket connection established to 127.0.0.1/127.0.0.1:42470, initiating session 11:51:20,168 INFO ~ Accepted socket connection from /127.0.0.1:42482 11:51:20,168 INFO ~ Client attempting to establish new session at /127.0.0.1:42482 11:51:20,182 INFO ~ Established session 0x1542e25578e0001 with negotiated timeout 20000 for client /127.0.0.1:42482 11:51:20,183 INFO ~ Session establishment complete on server 127.0.0.1/127.0.0.1:42470, sessionid = 0x1542e25578e0001, negotiated timeout = 20000 11:51:20,183 INFO ~ Watcher org.apache.solr.common.cloud.ConnectionManager@41fcadf8 name:ZooKeeperConnection Watcher:127.0.0.1:42470/solr got event WatchedEvent state:SyncConnected type:None path:null path:null type:None 11:51:20,183 INFO ~ Client is connected to ZooKeeper 11:51:20,183 INFO ~ Using default ZkACLProvider 11:51:20,184 INFO ~ solr.xml found in ZooKeeper. Loading... 11:51:20,258 INFO ~ Processed session termination for sessionid: 0x1542e25578e0001 11:51:20,268 INFO ~ Session: 0x1542e25578e0001 closed 11:51:20,268 INFO ~ Closed socket connection for client /127.0.0.1:42482 which had sessionid 0x1542e25578e0001 11:51:20,268 INFO ~ EventThread shut down for session: 0x1542e25578e0001 11:51:20,272 INFO ~ Config-defined core root directory: C:\projects\gossprojects\goss-typeahead-solr6\goss-typeahead-solrhandlers\src\testdata\minicluster\node1\. 11:51:20,294 INFO ~ New CoreContainer 2040027013 11:51:20,294 INFO ~ Loading cores into CoreContainer [instanceDir=C:\projects\gossprojects\goss-typeahead-solr6\goss-typeahead-solrhandlers\src\testdata\minicluster\node1] 11:51:20,295 WARN ~ Couldn't add files from C:\projects\gossprojects\goss-typeahead-solr6\goss-typeahead-solrhandlers\src\testdata\minicluster\node1\lib to classpath: C:\projects\gossprojects\goss-typeahead-solr6\goss-typeahead-solrhandlers\src\testdata\minicluster\node1\lib 11:51:20,305 INFO ~ created with socketTimeout : 90000,urlScheme : ,connTimeout : 15000,maxConnectionsPerHost : 20,maxConnections : 10000,corePoolSize : 0,maximumPoolSize : 2147483647,maxThreadIdleTime : 5,sizeOfQueue : -1,fairnessPolicy : false,useRetries : false, 11:51:20,347 ERROR ~ Could not start Solr. Check solr/home property and the logs 11:51:20,378 ERROR ~ null:org.apache.solr.common.SolrException: Error instantiating shardHandlerFactory class [HttpShardHandlerFactory]: The socket connect and read timeout cannot be set here and must be set at org.apache.solr.handler.component.ShardHandlerFactory.newInstance(ShardHandlerFactory.java:52) at org.apache.solr.core.CoreContainer.load(CoreContainer.java:404) at org.apache.solr.servlet.SolrDispatchFilter.createCoreContainer(SolrDispatchFilter.java:134) at org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:110) at org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:137) at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:856) at org.eclipse.jetty.servlet.ServletHandler.updateMappings(ServletHandler.java:1542) at org.eclipse.jetty.servlet.ServletHandler.setFilterMappings(ServletHandler.java:1576) at org.eclipse.jetty.servlet.ServletHandler.addFilterMapping(ServletHandler.java:1268) at org.eclipse.jetty.servlet.ServletHandler.addFilterWithMapping(ServletHandler.java:1113) at org.eclipse.jetty.servlet.ServletContextHandler.addFilter(ServletContextHandler.java:447) at org.apache.solr.client.solrj.embedded.JettySolrRunner$1.lifeCycleStarted(JettySolrRunner.java:259) at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarted(AbstractLifeCycle.java:179) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69) at org.apache.solr.client.solrj.embedded.JettySolrRunner.start(JettySolrRunner.java:327) at org.apache.solr.cloud.MiniSolrCloudCluster.startJettySolrRunner(MiniSolrCloudCluster.java:325) at org.apache.solr.cloud.MiniSolrCloudCluster.lambda$new$2(MiniSolrCloudCluster.java:210) at org.apache.solr.cloud.MiniSolrCloudCluster$$Lambda$4/1638215613.call(Unknown Source) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$12(ExecutorUtil.java:229) at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor$$Lambda$3/1315683944.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 11:51:20,378 INFO ~ SolrDispatchFilter.init() done 11:51:20,378 INFO ~ Using default ZkCredentialsProvider 11:51:20,378 INFO ~ Initiating client connection, connectString=127.0.0.1:42470 sessionTimeout=45000 watcher=org.apache.solr.common.cloud.SolrZkClient$3@63d4e2ba 11:51:20,380 INFO ~ Waiting for client to connect to ZooKeeper 11:51:20,380 INFO ~ Opening socket connection to server 127.0.0.1/127.0.0.1:42470. Will not attempt to authenticate using SASL (unknown error) 11:51:20,381 INFO ~ Socket connection established to 127.0.0.1/127.0.0.1:42470, initiating session 11:51:20,381 INFO ~ Accepted socket connection from /127.0.0.1:42486 11:51:20,381 INFO ~ Client attempting to establish new session at /127.0.0.1:42486 11:51:20,397 INFO ~ Established session 0x1542e25578e0002 with negotiated timeout 20000 for client /127.0.0.1:42486 11:51:20,398 INFO ~ Session establishment complete on server 127.0.0.1/127.0.0.1:42470, sessionid = 0x1542e25578e0002, negotiated timeout = 20000 11:51:20,398 INFO ~ Watcher org.apache.solr.common.cloud.ConnectionManager@159886f2 name:ZooKeeperConnection Watcher:127.0.0.1:42470 got event WatchedEvent state:SyncConnected type:None path:null path:null type:None 11:51:20,398 INFO ~ Client is connected to ZooKeeper 11:51:20,398 INFO ~ Using default ZkACLProvider 11:52:19,448 INFO ~ Processed session termination for sessionid: 0x1542e25578e0002 11:52:19,476 INFO ~ Session: 0x1542e25578e0002 closed 11:52:19,476 INFO ~ EventThread shut down for session: 0x1542e25578e0002 11:52:19,476 INFO ~ Closed socket connection for client /127.0.0.1:42486 which had sessionid 0x1542e25578e0002 11:52:19,492 INFO ~ Stopped ServerConnector@5ba090a4{HTTP/1.1,[http/1.1]}{0.0.0.0:0} 11:52:19,492 INFO ~ Shutting down CoreContainer instance=2040027013 11:52:19,497 INFO ~ Stopped o.e.j.s.ServletContextHandler@5ccad1a7{/solr,null,UNAVAILABLE} 11:52:19,498 WARN ~ ServletContextHandler.setHandler should not be called directly. Use insertHandler or setSessionHandler etc. -----Original Message----- From: Shawn Heisey [mailto:apa...@elyograg.org] Sent: 15 April 2016 21:01 To: solr-user@lucene.apache.org 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.