【问题标题】:Solr Setup - Error: Could not find or load main class org.apache.solr.cloud.ZkCLISolr 设置 - 错误:无法找到或加载主类 org.apache.solr.cloud.ZkCLI
【发布时间】:2015-01-14 10:28:13
【问题描述】:

我正在按照教程使用 Windows 7、Java 版本 1.8 和 Solr 版本 4.10.2 设置 Solr (http://lucene.apache.org/solr/quickstart.html)。

Java 安装在 C:\root\java,Solr 安装在 c:\root\solr-4.10.2。

我添加了 2 个环境变量作为用户变量:

CLASSPATH = C:\ROOT\solr-4.10.2\dist\solr-core-4.10.2.jar
JAVA_HOME = c:\root\java

然后我在命令提示符中运行以下代码:

cd c:\root\solr-4.10.2\bin & solr start -e cloud -noprompt

输出粘贴在下面。 collection1 的 Solr 服务器似乎工作正常,尽管未添加入门核心。但是,为什么 ZkCLI 和 SolrCLI 会出现错误?我做错了吗?

Welcome to the SolrCloud example


Starting up  Solr nodes for your example SolrCloud cluster.
Starting node1 on port 8983 using command:
solr -cloud -p 8983 -d node1

Waiting for  0 seconds, press a key to continue ...
Starting node2 on port 7574 using command:
solr -cloud -p 7574 -d node2 -z localhost:9983

Waiting for  0 seconds, press a key to continue ...

Now let's create a new collection for indexing documents in your 2-node cluster.


Deploying default Solr configuration files to embedded ZooKeeper

Error: Could not find or load main class org.apache.solr.cloud.ZkCLI
Creating new collection gettingstarted with 2 shards and replication factor 2 us
ing Collections API command:

"http://localhost:8983/solr/admin/collections?action=CREATE&name=gettingstarted&
replicationFactor=2&numShards=2&collection.configName=default&maxShardsPerNode=3
&wt=json&indent=2"

For more information about the Collections API, please see: https://cwiki.apache
.org/confluence/display/solr/Collections+API

Error: Could not find or load main class org.apache.solr.util.SolrCLI

SolrCloud example is running, please visit http://localhost:8983/solr"


c:\ROOT\solr-4.10.2\bin>java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

c:\ROOT\solr-4.10.2\bin>

【问题讨论】:

    标签: java windows solr lucene apache-zookeeper


    【解决方案1】:

    在另一个 site 上找到了这个,它对我有用。

    如果您在不使用云选项的情况下运行 solr,它会执行一些额外的操作,以使云选项正常工作。

    因此,只需运行 solr.cmd start,然后运行 ​​solr.cmd stop -p 8983 即可进行准备。

    然后最后运行solr.cmd start -e cloud -noprompt

    应该在教程中注明,但 Solr 似乎对 Windows 不友好。我认为环境变量也很重要,因此感谢您提供的信息。

    【讨论】:

    • 您的解决方案在没有问题中提到的任何环境变量的情况下运行良好。
    【解决方案2】:

    另外,请确保您尚未下载源存档。从 6.6.1 版 (solr-6.6.1-src.) 开始,源代码约为 52mb,而本教程所需的存档约为 145mb (solr-6.6.1.)。

    【讨论】:

      【解决方案3】:

      我遇到了同样的问题,搜索后我意识到我错过了 "ant compile" 步骤。

      这对我有用

       1073  tar -zxvf solr-5.3.1-src.tgz
       1074  cd solr-5.3.1
       1076  nano README.txt
       1077  ant compile
       1096  cd solr
       1098  cd bin
       1100  chmod a+x solr
       1108  cd ..
       1111  cd solr
       1112  ant server
       1113  bin/solr start
      
      [vagrant@localhost solr]$ java -version
      java version "1.7.0_91"
      OpenJDK Runtime Environment (rhel-2.6.2.1.el7_1-x86_64 u91-b00)
      OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)
      
      [vagrant@localhost solr]$ ant -version
      Apache Ant(TM) version 1.9.2 compiled on June 10 2014
      
      [vagrant@localhost solr]$ cat /etc/*release
      CentOS Linux release 7.0.1406 (Core)
      NAME="CentOS Linux"
      VERSION="7 (Core)"
      ID="centos"
      ID_LIKE="rhel fedora"
      VERSION_ID="7"
      PRETTY_NAME="CentOS Linux 7 (Core)"
      ANSI_COLOR="0;31"
      CPE_NAME="cpe:/o:centos:centos:7"
      HOME_URL="https://www.centos.org/"
      BUG_REPORT_URL="https://bugs.centos.org/"
      
      CentOS Linux release 7.0.1406 (Core)
      CentOS Linux release 7.0.1406 (Core)
      

      【讨论】:

      • Funciono para mi
      【解决方案4】:

      遇到了同样的问题。

      问题源于 solr 目录中已经存在的 webapp 目录。当演示运行 zkcli.sh 时,它会检查 webapp 目录是否存在,如果存在,则不执行任何操作。如果它不存在,它实际上会提取 webapps 目录中的 solr.war。默认情况下,4.10.2 包的 webapp 目录存在但为空,这会导致东西抛出有趣的类路径错误。

      例如。您将 solr-4.10.2.tgz 提取到 ~/solr-4.10.2

      转到~/solr-4.10.2/example/solr-webapp/webapp,检查webapp目录中是否有任何东西(你不应该),删除webapp目录。

      应该解决问题。

      【讨论】:

        【解决方案5】:

        在 SolrCloud 章节中,参考指南明确指出:

        "在开始之前,请确保在非 SolrCloud 模式下从示例目录运行 Solr 至少一次;此过程会解压缩运行 SolrCloud 所需的 jar 文件。但是,暂时不要加载文档,只需启动一次并关闭它。”

        他们应该使用此信息更新教程。

        【讨论】:

          【解决方案6】:

          这对我有用

          java -classpath example\exampledocs\post.jar -Dauto=yes -Dc=gettingstarted -Ddata=files -Drecursive=yes org.apache.solr.util.SimplePostTool docs/

          https://cwiki.apache.org/confluence/display/solr/Post+Tool#PostTool-Windows

          【讨论】:

            【解决方案7】:

            该类捆绑在 solr-core-4.x.y.jar 中,因此如果您在 Solr 中的 Zookeeper 之外运行实用程序脚本,它必须在您的类路径中可用。

            您可以在dist/solr-core-4.x.y.jar 下找到 solr-core-4.x.y.jar。将 x.y 替换为您当前的版本号。

            【讨论】:

            • 我确实输入了以下 CLASSPATH 变量,但无论如何都会出现错误。 C:\ROOT\solr-4.10.2\dist\solr-core-4.10.2.jar
            • 我在原始问题中添加了更多详细信息。
            【解决方案8】:

            Apache Solr 的 GitHub 分布不一定对应于Solr Reference Guide 分布。

            我从Solr Reference Guide 下载了.tgz 安装,现在程序在终端中运行bin/solr startbin/solr start -e cloud

            澄清:使用 MacOS,我从Solr Downloads page 下载了solr-8.1.0.tgz

            【讨论】:

              猜你喜欢
              • 2017-07-25
              • 2016-06-12
              • 2016-03-16
              • 2016-01-03
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多