为什么我不能在 JBoss 上的 Solr 中实例化 DataImportHandler? [英] Why can't I instantiate DataImportHandler in Solr on JBoss?

查看:22
本文介绍了为什么我不能在 JBoss 上的 Solr 中实例化 DataImportHandler?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 JBoss 5.1 上设置 Solr 3.5.0.一切都很好.我将 war 复制到 deploy 目录中,将 dist 和 contrib 目录中的所有依赖项复制到 lib(或更早的 deploy)目录中.

I'm trying to set up Solr 3.5.0 on JBoss 5.1. Everything works quite fine. I copied war into deploy dir, all the dependencies from dist and contrib directories into the lib (or earlier deploy) directory.

我可以启动服务器,一切正常,但是每当我想激活 DataImportHandler 以索引数据库中的数据时,我都会收到错误消息.

I can start a server, everything works fine, but whenever I want to activate the DataImportHandler to index data in my DB, I get an error.

基本上我所做的是我复制的是我从example/example-DIH/solr/db(或整个示例,没关系)复制一个核心,我在solr.xml中注册核心,并在启动时得到错误:

Basically what I do is I copy is I copy a core from example/example-DIH/solr/db (Or whole example, that doesn't matter), I register the core in solr.xml and at startup I get an error:

15:17:10,707 SEVERE [RequestHandlers] org.apache.solr.common.SolrException: Error Instantiating Request Handler, org.apache.solr.handler.dataimport.DataImportHandler is not a org.apache.solr.request.SolrRequestHandler
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:427)
at org.apache.solr.core.SolrCore.createRequestHandler(SolrCore.java:461)
at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:157)

我很确定我的请求处理程序定义是正确的,但要确定:

I'm pretty sure my request handler definition is correct, but just to be sure:

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

据我所知,这个错误可能是由于 DataImportHandler 和 SolrRequestHandler 持有不同的类加载器造成的.

As far as I can find, this error may be caused by DataImportHandler and SolrRequestHandler supposedly being hold different class loaders.

每当我从示例中的 start.jar 应用程序启动 Solr 时(我认为它会启动一个 Jetty 服务器),它运行良好.

Whenever I start a Solr from the start.jar app in example (I think it starts a Jetty server) it works fine.

我的问题是:这真的是因为类加载器的问题,还是其他什么原因?而且,更重要的是:我该如何解决?

My question is: is this really because of the class loader issue, or some other thing? And, more importantly: how do I fix it?

推荐答案

这是一个类加载器问题,根据这个 在 Lucene 开发者邮件列表上发帖,您需要执行以下操作:

This is a class loader issue and according to this post on the Lucene Developer Mailing List you need to do the following:

确保数据导入 jar 不在类路径中,也不是由其他类加载器加载,而是从 solrconfig.xml 中指定的路径加载.这将确保数据导入类由同一个类加载器加载.

make sure that the dataimport jars are NOT in the classpath and not loaded by other classloaders but from the path specified in solrconfig.xml. This will ensure that the dataimport classes are loaded by the same classloader.

有关详细信息,请参阅线程.

Please see the thread for more details.

这篇关于为什么我不能在 JBoss 上的 Solr 中实例化 DataImportHandler?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆