2

特定の問題を検索しようとしましたが、解決策が見つかりませんでした。DIH の wiki も読みましたが、すべてが正しく設定されているように見えますが、クエリはまだ失敗します。ご協力ありがとうございました

Tomcat 6.0 Windows サーバー 2003 r2 および SQL 2008 で Solr 3.1 を実行しています。

C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib に sqljdbc4.jar があります

私のsolrconfig.xml

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

私の db-data-config.xml

<dataConfig>
<dataSource driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"      url="://localhost:1433;DatabaseName=KnowledgeBase_DM" user="user" password="password" /> 
<document>
<entity name="Titles" query="SELECT mrID, mrTitle from KnowledgeBase_DM.dbo.AskMe_Data">
<field column="mrID" name="id" />  
<field column="mrTitle" name="title" />  
<entity name="Desc" query="select meDescription from KnowledgeBase_DM.dbo.AskMe_Data">
<field column="meDescription" name="description" />  
</entity>
</entity>
</document>
</dataConfig>

ログの内容:

Jan 25, 2012 2:17:37 PM org.apache.solr.handler.dataimport.DataImportHandler processConfiguration
 INFO: Processing configuration from solrconfig.xml: {config=db-data-config.xml}
 Jan 25, 2012 2:17:37 PM org.apache.solr.handler.dataimport.DataImporter loadDataConfig
 INFO: Data Configuration loaded successfully 
Jan 25, 2012 2:17:37 PM org.apache.solr.handler.dataimport.DataImporter doFullImport
 INFO: Starting Full Import 
Jan 25, 2012 2:17:37 PM org.apache.solr.handler.dataimport.SolrWriter readIndexerProperties
 **WARNING: Unable to read: dataimport.properties**
Jan 25, 2012 2:17:37 PM org.apache.solr.handler.dataimport.JdbcDataSource$1 call
 INFO: Creating a connection for entity Titles with URL: ://localhost:1433;DatabaseName=KnowledgeBase_DM
 Jan 25, 2012 2:17:37 PM org.apache.solr.handler.dataimport.JdbcDataSource$1 call
 INFO: Time taken for getConnection(): 0 
Jan 25, 2012 2:17:37 PM org.apache.solr.common.SolrException log 
**SEVERE: Exception while processing: Titles document : SolrInputDocument[{}]:org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT mrID, mrTitle from KnowledgeBase_DM.dbo.AskMe_Data Processing Document # 1**
        at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)
         at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:253)
         at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
         at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
         at org.apache.solr.handler.dataimport.DebugLogger$2.getData(DebugLogger.java:188)
         at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
         at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
         at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238)
         at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:591)
         at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:267)
         at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:186)
         at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:353)
         at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:411)
         at org.apache.solr.handler.dataimport.DataImportHandler.handleRequestBody(DataImportHandler.java:205)
         at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
         at org.apache.solr.core.SolrCore.execute(SolrCore.java:1360) 
        at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
         at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
         at java.lang.Thread.run(Unknown Source) 
Caused by: java.lang.NullPointerException 
        at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:241)
         ... 28 more 

Jan 25, 2012 2:17:37 PM org.apache.solr.common.SolrException log 
**SEVERE: Full Import failed:org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT mrID, mrTitle from KnowledgeBase_DM.dbo.AskMe_Data Processing Document # 1**
        at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72)
         at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:253)
         at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:210)
         at org.apache.solr.handler.dataimport.JdbcDataSource.getData(JdbcDataSource.java:39)
         at org.apache.solr.handler.dataimport.DebugLogger$2.getData(DebugLogger.java:188)
         at org.apache.solr.handler.dataimport.SqlEntityProcessor.initQuery(SqlEntityProcessor.java:59)
         at org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:73)
         at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:238)
         at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:591)
         at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:267)
         at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:186)
         at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:353)
         at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:411)
         at org.apache.solr.handler.dataimport.DataImportHandler.handleRequestBody(DataImportHandler.java:205)
         at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
         at org.apache.solr.core.SolrCore.execute(SolrCore.java:1360) 
        at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
         at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
         at java.lang.Thread.run(Unknown Source) 
Caused by: java.lang.NullPointerException 
        at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:241)
         ... 28 more 

Jan 25, 2012 2:17:37 PM org.apache.solr.update.DirectUpdateHandler2 rollback 
INFO: start rollback 
Jan 25, 2012 2:17:37 PM org.apache.solr.update.DirectUpdateHandler2 rollback 
INFO: end_rollback 
Jan 25, 2012 2:17:37 PM org.apache.solr.core.SolrCore execute 
INFO: [] webapp=/solr path=/select params={start=0&dataConfig=<dataConfig>%0d%0a%09<dataSource+driver%3D"com.microsoft.sqlserver.jdbc.SQLServerDriver"+url%3D"://localhost:1433;DatabaseName%3DKnowledgeBase_DM"+user%3D"user"+password%3D"password"+/>%0d%0a%09<document>%0d%0a%09%09<entity+dataSource%3D"ds1"+name%3D"Titles"+query%3D"SELECT+mrID,+mrTitle+from+KnowledgeBase_DM.dbo.AskMe_Data">%0d%0a%09%09%09<field+column%3D"mrID"+name%3D"id"+/>%0d%0a%09%09%09<field+column%3D"mrTitle"+name%3D"title"+/>%0d%0a%09%09%09<entity+name%3D"Desc"+query%3D"select+meDescription+from+KnowledgeBase_DM.dbo.AskMe_Data">%0d%0a%09%09%09%09<field+column%3D"meDescription"+name%3D"description"+/>%0d%0a%09%09%09</entity>%0d%0a%09%09</entity>%0d%0a%09</document>%0d%0a</dataConfig>&verbose=on&command=full-import&debug=on&qt=/dataimport&rows=10} status=0 QTime=10
4

2 に答える 2

1

データベースへの接続に使用するプロトコルの説明を忘れているようです。MSSQL の場合は

url="jdbc:sqlserver://localhost:1433;DatabaseName=KnowledgeBase_DM" 

URLでデータベース名を選択したので、クエリでデータベース名を再表示する必要はないと確信しています。クエリは次のようになります。

 query="SELECT mrID, mrTitle from dbo.AskMe_Data"

私は MSSQL を使用したことがないので、dbo.AskMe_Data を使用する必要があるのか​​、それとも私がいつも使用しているように、AskMe_Data を使用する必要があるのか​​ わかりません。

このコードは問題を解決するはずだと思います:

<dataConfig>
    <dataSource  type="JdbcDataSource" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
        url="jdbc:sqlserver://localhost:1433;DatabaseName=KnowledgeBase_DM" user="user" password="password" /> 
    <document>
        <entity name="Titles" query="SELECT mrID, mrTitle from dbo.AskMe_Data">
            <field column="mrID" name="id" />  
            <field column="mrTitle" name="title" />  
            <entity name="Desc" query="select meDescription from dbo.AskMe_Data">
                <field column="meDescription" name="description" />  
            </entity>
        </entity>
    </document>
</dataConfig>
于 2012-01-25T23:14:50.290 に答える
-1

sqljdbc4.jar は別のディレクトリに配置する必要があります

これが構成ファイルの場所である場合

C:\Program Files\Apache Software Foundation\Tomcat 6.0\solr\conf\solrconfig.xml

次に、sqljdbc4.jar を次の場所に配置する必要があります。

C:\Program Files\Apache Software Foundation\Tomcat 6.0\solr\lib\sqljdbc4.jar
于 2012-01-28T15:25:14.337 に答える