在 SOLR4 上启用 DIH 时出错

在 SOLR4 上启用 DIH 时出错

我有点卡在这里。我使用 Solr4.4 时没有遇到太多问题。我想启用 DIH,因此我首先在 solrconfig.xml 中添加了以下几行:

<lib dir="../contrib/dataimporthandler/lib" regex=".*\.jar" />
<lib dir="../dist/" regex="apache-solr-dataimporthandler-.*\.jar" />

重新启动后一切都正常了。然后我在配置中添加了以下几行,这破坏了 Solr:

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
      <str name="config">/opt/solr/collection1/conf/data-config.xml</str>
    </lst>
  </requestHandler>

这是它给我的错误:

HTTP ERROR 500 

Problem accessing /solr/. Reason: 

    {msg=SolrCore 'collection1' is not available due to init failure: RequestHandler init failure,trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: RequestHandler init failure 
        at org.apache.solr.core.CoreContainer.getCore(CoreContainer.java:860) 
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:251) 
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:158) 
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1486) 
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) 
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:138) 
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:540) 
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:213) 
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1094) 
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432) 
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175) 
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1028) 
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136) 
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:258) 
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109) 
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) 
        at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:317) 
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) 
        at org.eclipse.jetty.server.Server.handle(Server.java:445) 
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:267) 
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:224) 
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358) 
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601) 
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532) 
        at java.lang.Thread.run(Thread.java:724) 
Caused by: org.apache.solr.common.SolrException: RequestHandler init failure 
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:835) 
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:629) 
        at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:622) 
        at org.apache.solr.core.CoreContainer.create(CoreContainer.java:657) 
        at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:364) 
        at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:356) 
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) 
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
        ... 1 more 
Caused by: org.apache.solr.common.SolrException: RequestHandler init failure 
        at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:167) 
        at org.apache.solr.core.SolrCore.<init>(SolrCore.java:772) 
        ... 13 more 
Caused by: org.apache.solr.common.SolrException: Error loading class 'org.apache.solr.handler.dataimport.DataImportHandler' 
        at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:449) 
        at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:381) 
        at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:530) 
        at org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:603) 
        at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:153) 
        ... 14 more 
Caused by: java.lang.ClassNotFoundException: org.apache.solr.handler.dataimport.DataImportHandler 
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366) 
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
        at java.security.AccessController.doPrivileged(Native Method) 
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
        at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:787) 
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
        at java.lang.Class.forName0(Native Method) 
        at java.lang.Class.forName(Class.java:270) 
        at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:433) 
        ... 18 more 
,code=500}

有人能告诉我我做错了什么吗?只要我删除这些行,一切就会恢复正常。

答案1

看起来您可能没有将 data-config.xml 放在它期望查找的位置。(/opt/solr/collection1/conf/data-config.xml

请参阅http://wiki.apache.org/solr/DIHQuickStart

如果您不再使用 collection1 作为核心(example-DIH 则不会),系统重启可能会有所帮助 - 它对我遇到的类似问题有用。我想有一些易失性存储设置。如果这不可行,我建议追踪相关的属性文件并检查或删除它们...

相关内容