You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by th...@apache.org on 2015/01/27 16:00:33 UTC

svn commit: r1655058 - in /lucene/dev/trunk/solr: CHANGES.txt bin/solr bin/solr.cmd core/src/java/org/apache/solr/util/SolrCLI.java

Author: thelabdude
Date: Tue Jan 27 15:00:32 2015
New Revision: 1655058

URL: http://svn.apache.org/r1655058
Log:
SOLR-7037: bin/solr start -e techproducts -c fails to start Solr in cloud mode

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/bin/solr
    lucene/dev/trunk/solr/bin/solr.cmd
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1655058&r1=1655057&r2=1655058&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Tue Jan 27 15:00:32 2015
@@ -556,6 +556,9 @@ Bug Fixes
 * SOLR-7038: Validate the presence of configset before trying to create a collection.
   (Anshum Gupta, Mark Miller)
 
+* SOLR-7037: bin/solr start -e techproducts -c fails to start Solr in cloud mode
+  (Timothy Potter)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/trunk/solr/bin/solr
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/bin/solr?rev=1655058&r1=1655057&r2=1655058&view=diff
==============================================================================
--- lucene/dev/trunk/solr/bin/solr (original)
+++ lucene/dev/trunk/solr/bin/solr Tue Jan 27 15:00:32 2015
@@ -1022,6 +1022,7 @@ if [ "$EXAMPLE" != "" ]; then
             mkdir -p $SOLR_HOME
             if [ ! -f "$SOLR_HOME/solr.xml" ]; then
               cp $DEFAULT_SERVER_DIR/solr/solr.xml $SOLR_HOME/solr.xml
+              cp $DEFAULT_SERVER_DIR/solr/zoo.cfg $SOLR_HOME/zoo.cfg
             fi
             EXAMPLE_CONFIGSET=sample_techproducts_configs
             shift
@@ -1035,6 +1036,7 @@ if [ "$EXAMPLE" != "" ]; then
             mkdir -p $SOLR_HOME
             if [ ! -f "$SOLR_HOME/solr.xml" ]; then
               cp $DEFAULT_SERVER_DIR/solr/solr.xml $SOLR_HOME/solr.xml
+              cp $DEFAULT_SERVER_DIR/solr/zoo.cfg $SOLR_HOME/zoo.cfg
             fi
             EXAMPLE_CONFIGSET=data_driven_schema_configs
             shift

Modified: lucene/dev/trunk/solr/bin/solr.cmd
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/bin/solr.cmd?rev=1655058&r1=1655057&r2=1655058&view=diff
==============================================================================
--- lucene/dev/trunk/solr/bin/solr.cmd (original)
+++ lucene/dev/trunk/solr/bin/solr.cmd Tue Jan 27 15:00:32 2015
@@ -569,6 +569,9 @@ IF "%EXAMPLE%"=="" (
   IF NOT EXIST "!SOLR_HOME!\solr.xml" (
     copy "%DEFAULT_SERVER_DIR%\solr\solr.xml" "!SOLR_HOME!\solr.xml"
   )
+  IF NOT EXIST "!SOLR_HOME!\zoo.cfg" (
+    copy "%DEFAULT_SERVER_DIR%\solr\zoo.cfg" "!SOLR_HOME!\zoo.cfg"
+  )
 ) ELSE IF "%EXAMPLE%"=="cloud" (
   set SOLR_MODE=solrcloud
   goto cloud_example_start
@@ -580,6 +583,9 @@ IF "%EXAMPLE%"=="" (
   IF NOT EXIST "!SOLR_HOME!\solr.xml" (
     copy "%DEFAULT_SERVER_DIR%\solr\solr.xml" "!SOLR_HOME!\solr.xml"
   )
+  IF NOT EXIST "!SOLR_HOME!\zoo.cfg" (
+    copy "%DEFAULT_SERVER_DIR%\solr\zoo.cfg" "!SOLR_HOME!\zoo.cfg"
+  )
 ) ELSE (
   @echo.
   @echo 'Unrecognized example %EXAMPLE%!'

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java?rev=1655058&r1=1655057&r2=1655058&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/util/SolrCLI.java Tue Jan 27 15:00:32 2015
@@ -478,7 +478,16 @@ public class SolrCLI {
     public Map<String,Object> handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
       HttpEntity entity = response.getEntity();
       if (entity != null) {
-        Object resp = ObjectBuilder.getVal(new JSONParser(EntityUtils.toString(entity)));
+
+        String respBody = EntityUtils.toString(entity);
+        Object resp = null;
+        try {
+          resp = ObjectBuilder.getVal(new JSONParser(respBody));
+        } catch (JSONParser.ParseException pe) {
+          throw new ClientProtocolException("Expected JSON response from server but received: "+respBody+
+              "\nTypically, this indicates a problem with the Solr server; check the Solr server logs for more information.");
+        }
+
         if (resp != null && resp instanceof Map) {
           return (Map<String,Object>)resp;
         } else {
@@ -1495,13 +1504,17 @@ public class SolrCLI {
       int result = -1;
       Tool tool = null;
       try {
-        Map<String,Object> systemInfo = getJson(httpClient, systemInfoUrl, 2);
+        Map<String, Object> systemInfo = getJson(httpClient, systemInfoUrl, 2);
         if ("solrcloud".equals(systemInfo.get("mode"))) {
           tool = new CreateCollectionTool();
         } else {
           tool = new CreateCoreTool();
         }
         result = tool.runTool(cli);
+      } catch (Exception exc) {
+        System.err.println("ERROR: create failed due to: "+exc.getMessage());
+        System.err.println();
+        result = 1;
       } finally {
         closeHttpClient(httpClient);
       }