英文:
Index PDF Documents to Solr - Error 500 java.lang.NoClassDefFoundError: org/eclipse/jetty/server/MultiParts
问题
我正在尝试将PDF文档的索引添加到我的Apache Solr核心。
我已经在我的solrconfig.xml
中添加了必要的库:
<lib dir="${solr.install.dir:../../..}/contrib/extraction/lib" regex=".*\.jar" />
<lib dir="${solr.install.dir:../../..}/dist/" regex="solr-cell-\d.*\.jar" />
我还为索引PDF文档添加了RequestHandler:
<requestHandler name="/update/extract"
startup="lazy"
class="solr.extraction.ExtractingRequestHandler" >
<lst name="defaults">
<str name="lowernames">true</str>
<str name="fmap.content">_text_</str>
</lst>
</requestHandler>
之后,我重新启动了Solr服务器,然后尝试使用curl来索引PDF文档:
curl 'http://localhost:8983/solr/test/update/extract?literal.id=doc1&commit=true' -F "myfile=@C:\Workspace\solr\solr-8.6.0\docs\pdf\test.pdf"
我期望文档被索引,但实际上我收到了一个Error 500 java.lang.NoClassDefFoundError: org/eclipse/jetty/server/MultiParts
的错误。
<html> <head> <meta http-equiv="Content-Type"
> content="text/html;charset=utf-8"/> <title>Error 500
> java.lang.NoClassDefFoundError:
> org/eclipse/jetty/server/MultiParts</title> </head> <body><h2>HTTP
> ERROR 500 java.lang.NoClassDefFoundError:
> org/eclipse/jetty/server/MultiParts</h2> <table>
> <tr><th>URI:</th><td>/solr/test/update/extract</td></tr>
> <tr><th>STATUS:</th><td>500</td></tr>
> <tr><th>MESSAGE:</th><td>java.lang.NoClassDefFoundError:
> org/eclipse/jetty/server/MultiParts</td></tr>
> <tr><th>SERVLET:</th><td>default</td></tr> <tr><th>CAUSED
> BY:</th><td>java.lang.NoClassDefFoundError:
> org/eclipse/jetty/server/MultiParts</td></tr> </table> <h3>Caused
> by:</h3><pre>java.lang.NoClassDefFoundError:
> org/eclipse/jetty/server/MultiParts
> at org.apache.solr.servlet.SolrRequestParsers.cleanupMultipartFiles(SolrRequestParsers.java:624)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:443)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:345)
> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1596)
> at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
> at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
> at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:590)
> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
> at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
> at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1300)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
> at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
> at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
> at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1215)
> at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221)
> at org.eclipse.jetty.server.handler.InetAccessHandler.handle(InetAccessHandler.java:177)
> at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)
> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at org.eclipse.jetty.server.Server.handle(Server.java:500)
> at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
> at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
> at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
> at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
> at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
> at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
> at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
> at java.lang.Thread.run(Unknown Source) </pre>
>
> </body> </html>
>
> 有人有想法吗?
>
> 谢谢!
<details>
<summary>英文:</summary>
I'm trying to test an index of PDF documents to my Apache Solr Core.
I found the following instruction:
https://lucene.apache.org/solr/guide/8_0/uploading-data-with-solr-cell-using-apache-tika.html#configuring-the-extractingrequesthandler-in-solrconfig-xml
I added the neccessary **libraries** to my ```solrconfig.xml```:
<lib dir="${solr.install.dir:../../..}/contrib/extraction/lib" regex=".*\.jar" />
<lib dir="${solr.install.dir:../../..}/dist/" regex="solr-cell-\d.*\.jar" />
I also added the **RequestHandler** for indexing the PDF documents:
<requestHandler name="/update/extract"
startup="lazy"
class="solr.extraction.ExtractingRequestHandler" >
<lst name="defaults">
<str name="lowernames">true</str>
<str name="fmap.content">_text_</str>
</lst>
</requestHandler>
Afterwards, I restarted my Solr server and then tried to index a PDF document by using **curl**:
curl 'http://localhost:8983/solr/test/update/extract?literal.id=doc1&commit=true' -F "myfile=@C:\Workspace\solr\solr-8.6.0\docs\pdf\test.pdf"
I expected the document to be indexed, but instead I get an ```Error 500 java.lang.NoClassDefFoundError: org/eclipse/jetty/server/MultiParts```:
> <html> <head> <meta http-equiv="Content-Type"
> content="text/html;charset=utf-8"/> <title>Error 500
> java.lang.NoClassDefFoundError:
> org/eclipse/jetty/server/MultiParts</title> </head> <body><h2>HTTP
> ERROR 500 java.lang.NoClassDefFoundError:
> org/eclipse/jetty/server/MultiParts</h2> <table>
> <tr><th>URI:</th><td>/solr/test/update/extract</td></tr>
> <tr><th>STATUS:</th><td>500</td></tr>
> <tr><th>MESSAGE:</th><td>java.lang.NoClassDefFoundError:
> org/eclipse/jetty/server/MultiParts</td></tr>
> <tr><th>SERVLET:</th><td>default</td></tr> <tr><th>CAUSED
> BY:</th><td>java.lang.NoClassDefFoundError:
> org/eclipse/jetty/server/MultiParts</td></tr> </table> <h3>Caused
> by:</h3><pre>java.lang.NoClassDefFoundError:
> org/eclipse/jetty/server/MultiParts
> at org.apache.solr.servlet.SolrRequestParsers.cleanupMultipartFiles(SolrRequestParsers.java:624)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:443)
> at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:345)
> at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1596)
> at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
> at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
> at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:590)
> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
> at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
> at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1300)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
> at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
> at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
> at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
> at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1215)
> at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
> at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221)
> at org.eclipse.jetty.server.handler.InetAccessHandler.handle(InetAccessHandler.java:177)
> at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)
> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
> at org.eclipse.jetty.server.Server.handle(Server.java:500)
> at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
> at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
> at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
> at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
> at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
> at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
> at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
> at java.lang.Thread.run(Unknown Source) </pre>
>
> </body> </html>
Has anyone an idea?
Thanks!
</details>
# 答案1
**得分**: 1
这是Solr 8.6.0和Solr 8.6.1的问题。请查看https://issues.apache.org/jira/browse/SOLR-14768
在问题在新的Solr版本中得到修复之前,将Solr降级至8.5.1版本应该可以解决这个问题。
<details>
<summary>英文:</summary>
It is an issue of Solr 8.6.0 and Solr 8.6.1. See https://issues.apache.org/jira/browse/SOLR-14768
Downgrading Solr to 8.5.1 should solve it until the issue is fixed in a new Solr release.
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论