当前位置: 首页 > 知识库问答 >
问题:

无法应用修补程序LUCENE-2899。Windows上SOLR的修补程序

夏侯浩气
2023-03-14

我试图应用补丁LUCENE-2899.patchSolr。

我已经这样做了:

  1. 从官方回购克隆solr(我在主分支)
  2. 下载并安装了ant和GNU补丁,我在这里得到它http://gnuwin32.sourceforge.net/packages/patch.htm
  3. 将蚂蚁和GNU补丁放入PATH环境变量。
  4. 我得到了这个...

```

D:\utils\solr_master\lucene-solr>patch -p1 -i LUCENE-2899.patch --dry-run
patching file dev-tools/idea/.idea/ant.xml
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

```

更新1

我正在尝试编译,但构建失败。

D:\utils\solr_master\lucene-solr>ant compile
Buildfile: D:\utils\solr_master\lucene-solr\build.xml

BUILD FAILED
D:\utils\solr_master\lucene-solr\build.xml:21: The following error occurred while executing this line:
D:\utils\solr_master\lucene-solr\lucene\common-build.xml:623: java.lang.NullPointerException
        at java.util.Arrays.stream(Arrays.java:5004)
        at java.util.stream.Stream.of(Stream.java:1000)
        at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:545)
        at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
        at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:438)
        at org.apache.tools.ant.util.ChainedMapper.lambda$mapFileName$1(ChainedMapper.java:36)
        at java.util.stream.ReduceOps$1ReducingSink.accept(ReduceOps.java:80)
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:484)
        at org.apache.tools.ant.util.ChainedMapper.mapFileName(ChainedMapper.java:35)
        at org.apache.tools.ant.util.CompositeMapper.lambda$mapFileName$0(CompositeMapper.java:32)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:545)
        at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
        at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:438)
        at org.apache.tools.ant.util.CompositeMapper.mapFileName(CompositeMapper.java:33)
        at org.apache.tools.ant.taskdefs.PathConvert.execute(PathConvert.java:363)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:346)
        at org.apache.tools.ant.Target.execute(Target.java:448)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:172)
        at org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:221)
        at org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:165)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        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:498)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:346)
        at org.apache.tools.ant.Target.execute(Target.java:448)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:183)
        at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
        at org.apache.tools.ant.Main.runBuild(Main.java:824)
        at org.apache.tools.ant.Main.startAnt(Main.java:228)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:283)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)

Total time: 0 seconds

更新2

我已经下载了Solr从

https://builds.apache.org/job/Solr-Artifacts-7.3/lastSuccessfulBuild/artifact/solr/package/和https://builds.apache.org/job/Solr-Artifacts-master/lastSuccessfulBuild/artifact/solr/package/

但无论是7.3版本还是8.0(主)版本,我都没有在contrib目录中看到opennlp目录。我在哪里能找到它?

更新3

我已经运行了从主分支下载的版本https://builds.apache.org/job/Solr-Artifacts-master/lastSuccessfulBuild/artifact/solr/package/在这篇文章中,我试图像绅士一样运行OpenNLP:

将openNLP与Solr集成时出现异常

但我和他有同样的错误。

numberplate\u shard1\u replica\u n1:
组织。阿帕奇。索尔。常见的SolrException:org。阿帕奇。索尔。常见的SolrException:

如果补丁LUCENE-2899被合并到master中,我为什么会有这个错误?

更新5

我重新启动了solr,错误消失了。但是

我试图添加字段(到托管模式)以形成示例(https://wiki.apache.org/solr/OpenNLP):

<fieldType name="text_opennlp" class="solr.TextField">
      <analyzer>
        <tokenizer class="solr.OpenNLPTokenizerFactory"
          sentenceModel="opennlp/en-sent.bin"
          tokenizerModel="opennlp/en-token.bin"
        />
      </analyzer>
    </fieldType>

    <field name="content" type="text_opennlp" indexed="true" termOffsets="true" stored="true" termPayloads="true" termPositions="true" docValues="false" termVectors="true" multiValued="true" required="true"/>

但当我尝试在云模式下运行Solr时,我发现:

D:\utils\solr-7.3.0-7\solr-7.3.0-7\bin>solr -e cloud

Welcome to the SolrCloud example!

This interactive session will help you launch a SolrCloud cluster on your local workstation.
To begin, how many Solr nodes would you like to run in your local cluster? (specify 1-4 nodes) [2]:
1
Ok, let's start up 1 Solr nodes for your example SolrCloud cluster.
Please enter the port for node1 [8983]:

Solr home directory D:\utils\solr-7.3.0-7\solr-7.3.0-7\example\cloud\node1\solr already exists.

Starting up Solr on port 8983 using command:
"D:\utils\solr-7.3.0-7\solr-7.3.0-7\bin\solr.cmd" start -cloud -p 8983 -s "D:\utils\solr-7.3.0-7\solr-7.3.0-7\example\cloud\node1\solr"

Waiting up to 30 to see Solr running on port 8983
Started Solr server on port 8983. Happy searching!
INFO  - 2018-03-26 14:42:26.961; org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider; Cluster at localhost:9983 ready

Now let's create a new collection for indexing documents in your 1-node cluster.
Please provide a name for your new collection: [gettingstarted]
numberplate

Collection 'numberplate' already exists!
Do you want to re-use the existing collection or create a new one? Enter 1 to reuse, 2 to create new [1]:
1

Enabling auto soft-commits with maxTime 3 secs using the Config API

POSTing request to Config API: http://localhost:8983/solr/numberplate/config
{"set-property":{"updateHandler.autoSoftCommit.maxTime":"3000"}}

ERROR: Error from server at http://localhost:8983/solr: Expected mime type application/octet-stream but got text/html. <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/numberplate/config. Reason:
<pre>    Not Found</pre></p>
</body>
</html>




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


D:\utils\solr-7.3.0-7\solr-7.3.0-7\bin>

更新6

我已经创建了新的集合,我得到了更精确的错误:

test_collection_shard1_replica_n1:

也许我需要复制OpenNLP模型http://opennlp.sourceforge.net/models-1.5/

但是我能把这些模型放在哪里呢?

你能帮帮我吗?我做错了什么?

共有1个答案

长孙瑞
2023-03-14

正如您在LUCENE-2899上看到的,该补丁已经应用于8.0(master)和7.3。

您可以在(目前)8.0的Solr-artifaces-master和7.3的Solr-artifaces-7.3找到预先构建的夜总会。

opennlp库捆绑在工件中:

solr-8.0.0-3304 find . -name '*nlp*'
[...]
./contrib/langid/lib/opennlp-tools-1.8.3.jar
./contrib/analysis-extras/lib/opennlp-maxent-3.0.3.jar
./contrib/analysis-extras/lib/opennlp-tools-1.8.3.jar
./contrib/analysis-extras/lucene-libs/lucene-analyzers-opennlp-8.0.0-3304.jar

然后,您必须告诉Solr加载这些JAR,这可以通过solrconfig来完成。xml

<lib dir="../../../contrib/analysis-extras/lib/" regex="opennlp-.*\.jar" />
<lib dir="../../../contrib/analysis-extras/lucene-libs/lucene-analyzers-opennlp-.*\.jar" regex=".*\.jar" />

确认JAR已按预期加载到Solr的日志文件中。

 类似资料:
  • 尝试了HttpURLConnection的其他解决方案后,无效的HTTP方法:PATCH 我得到无效的HTTP方法:补丁异常与JAVA 7。更新JAVA不在选项中,所以我必须坚持使用解决方法。 我正在使用调用来调用这样的请求 < code>getHTTPVerb()返回字符串“POST”或“PATCH”。 使用补丁方法我遇到了问题。 在提到的问题中,我没有尝试过一种解决方案: < code>con

  • 当我尝试使用非标准的HTTP方法时,比如带有URLConnection的补丁: 我有个例外: 使用更高级别的API(如Jersey)会产生相同的错误。是否有解决办法来发出修补程序HTTP请求?

  • 我对PersondTo有以下定义: 下面是一个示例记录: 现在,无名氏离婚了。所以我需要向这个URL发送补丁请求: 我想不出该怎么做。以下是我到目前为止所做的尝试: 以下是上面的问题: 1)由于我只设置了MaritalStatus,其他字段都将为null。因此,如果我打印出请求,它将如下所示: 请欣赏那些编写客户机应用程序的人提出的使用Spring的RESTTemplate使用Restful we

  • 当我试图在一个基于Spring MVC的应用程序上使用PayPal REST API更新一个账单计划的状态时,我遇到了一个ProtocolException。我的堆栈跟踪如下: 原因:java.net.ProtocolException:无效HTTP方法:PATCH at Java . net . httpurlconnection . setrequest method(httpurlconne

  • 有很多类似“REST vs SMTH”的比较(例如vs Kafka,vs JSON-RPC),但我也看到了JSON-RPC和JSON补丁之间的许多相似之处--它们都指定了操作/方法、值/参数,并允许执行批处理请求。我看到的唯一区别是,JSON-RPC还用ID和错误描述响应格式,因此看起来更加成熟。但也许它们只是有不同的优点和缺点,不同的合适用例?

  • 我正在尝试进行http补丁请求,但我总是得到404错误,所以可能是我的连接设置不正确: 我收到404错误,未找到。当使用Postman执行相同的请求时,这是有效的…谢谢你的帮助。

  • 我有一个带有spring框架的Java8应用程序。我们需要从应用程序中使用REST调用补丁操作。 代码片段如下: 请指教。

  • 我正在开发两个REST API,它在我的后端编辑和暂停一些东西。对于编辑,我使用的是: 什么是最好的方法开发暂停视频服务。我应该为此使用还是?输入将只是ID。如果我使用,那么如何区分编辑和暂停呢?如果我有另一个API需要开发,例如:视频重启,我如何在REST API中容纳这些动词?