0

我正在尝试将其mongo用作数据源,solr因此我跟随James的 DIH 在我的 solr 应用程序中使用它,我在我的lib文件夹中添加了以下内容

  1. solr-dataimporthandler-1.4.1
  2. solr-mongo-importer-1.0.0
  3. nlog4j-1.2.17 // 因为它要求 LoggerFactory 类
  4. mongo-2.10.1

在我的数据配置文件中,只需以下内容:

<?xml version="1.0"?>
<dataConfig>
    <dataSource name="MyMongo" type="MongoDataSource" database="tracker" />
    <document name="hits">
         <entity processor="MongoEntityProcessor"
                 query="{}"
                 collection="hits"
                 datasource="MyMongo"
                 transformer="MongoMapperTransformer" >
             <field column="_id"           name="_id"       mongoField="_id"/>
         </entity>
     </document>
</dataConfig>

每当我尝试进行完全导入时,都会抛出如下异常:

SEVERE: Full Import failed:java.lang.RuntimeException: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to load EntityProcessor implementation for entity:19099085523711 Processing Document # 1
at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:264)
at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:375)
at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:445)
at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:426)
Caused by: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to load EntityProcessor implementation for entity:19099085523711 Processing Document # 1
    at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:621)
    at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:327)
    at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:225)
    ... 3 more

Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to load EntityProcessor implementation for entity:19099085523711 Processing Document # 1
    at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)
    at org.apache.solr.handler.dataimport.DocBuilder.getEntityProcessor(DocBuilder.java:915)
    at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:635)
    at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:619)
    ... 5 more
Caused by: java.lang.ClassCastException: org.apache.solr.handler.dataimport.MongoEntityProcessor cannot be cast to org.apache.solr.handler.dataimport.EntityProcessor
    at org.apache.solr.handler.dataimport.DocBuilder.getEntityProcessor(DocBuilder.java:912)
    ... 7 more

谁能告诉我我在搞砸什么以及如何解决这个问题?

4

1 回答 1

3

问题的核心是:

引起:java.lang.ClassCastException:org.apache.solr.handler.dataimport.MongoEntityProcessor 不能转换为 org.apache.solr.handler.dataimport.EntityProcessor

I suspect you are not using the same version of Solr as he does. Based on the jars, you seem to be using Solr 1.4.1. Based on timestamps at GitHub, the integration project is 6 months old and might be using more recent Solr (3.6 or - less likely - 4+).

Unless your Solr is well-established system, I would download Solr 4 and try again, using the DIH jars that come with the installation

于 2013-02-19T16:28:33.507 回答