3

我在 Windows 环境下的 Tomcat 下运行 Solr 4.4。我已设置 DataImportHandler 并尝试从 SQL Server Express 2012 获取数据。在 SQL Server 实例上启用了 TCP/IP。

当我运行索引例程(http://server.com:8080/solr/dataimport?command=full-import)时,我收到错误“索引失败。回滚所有更改。”

回复

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">7</int>
</lst>
<lst name="initArgs">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</lst>
<str name="command">full-import</str>
<str name="status">idle</str>
<str name="importResponse"/>
<lst name="statusMessages">
<str name="Time Elapsed">0:1:19.495</str>
<str name="Total Requests made to DataSource">1</str>
<str name="Total Rows Fetched">0</str>
<str name="Total Documents Processed">0</str>
<str name="Total Documents Skipped">0</str>
<str name="Full Dump Started">2013-08-14 11:20:59</str>
<str name="">Indexing failed. Rolled back all changes.</str>
<str name="Rolledback">2013-08-14 11:21:28</str>
</lst>
<str name="WARNING">
This response format is experimental. It is likely to change in the future.
</str>
</response>

Solr 管理界面的日志

12:24:08 WARN SimplePropertiesWriter Unable to read: dataimport.properties

solrconfig.xml 请求处理程序

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

数据配置.xml

<dataConfig>  
  <dataSource type="JdbcDataSource" 
        driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
        url="jdbc:sqlserver://localhost\SQLEXPRESS2012;databaseName=dbname" 
        user="username" 
        password="password" 
        batchSize="-1" />

  <document name="products">  
    <entity name="product" query="  
        SELECT 

        ProductID,
        ProductNumber,
        ProductName,
        ProductShortDescription,
        ProductLongDescription,
        ProductPrice,
        ProductStock,
        ProductWeight,
        ProductVolume,
        ProductRating,
        color,
        capacity,
        suctionpower,
        noise,
        energyefficiency,
        centrifugation,
        washingcapacity,
        automaticdefrosting,
        bestintest,
        greenenergy,
        discount,
        testwinner,
        funded,
        productsubname,
        werecommend

        FROM EcomProducts">  

        <field column="ProductID" name="ProductID"/> 
        <field column="ProductNumber" name="ProductNumber"/> 
        <field column="ProductName" name="ProductName"/> 
        <field column="ProductShortDescription" name="ProductShortDescription"/> 
        <field column="ProductLongDescription" name="ProductLongDescription"/> 
        <field column="ProductPrice" name="ProductPrice"/> 
        <field column="ProductStock" name="ProductStock"/> 
        <field column="ProductWeight" name="ProductWeight"/> 
        <field column="ProductVolume" name="ProductVolume"/> 
        <field column="ProductRating" name="ProductRating"/> 
        <field column="color" name="color"/> 
        <field column="capacity" name="capacity"/> 
        <field column="suctionpower" name="suctionpower"/> 
        <field column="noise" name="noise"/> 
        <field column="energyefficiency" name="energyefficiency"/> 
        <field column="centrifugation" name="centrifugation"/> 
        <field column="washingcapacity" name="washingcapacity"/> 
        <field column="automaticdefrosting" name="automaticdefrosting"/> 
        <field column="bestintest" name="bestintest"/> 
        <field column="greenenergy" name="greenenergy"/> 
        <field column="discount" name="discount"/> 
        <field column="testwinner" name="testwinner"/> 
        <field column="funded" name="funded"/> 
        <field column="productsubname" name="productsubname"/> 
        <field column="werecommend" name="werecommend"/> 

    </entity>  
  </document>  
</dataConfig> 

架构.xml

 <fields>

 <field name="ProductID" type="string" indexed="true" stored="false" required="true" />  
 <field name="ProductNumber" type="string" indexed="true" stored="true" required="true" /> 
 <field name="ProductName" type="string" indexed="true" stored="true" required="true" />
 <field name="ProductShortDescription" type="string" indexed="true" stored="false" required="true" />
 <field name="ProductLongDescription" type="string" indexed="true" stored="false" required="true" /> 
 <field name="ProductPrice" type="float" indexed="true" stored="false" required="true" />

 <field name="ProductStock" type="float" indexed="true" stored="false" required="false" />
 <field name="ProductWeight" type="float" indexed="true" stored="false" required="false" />
 <field name="ProductVolume" type="float" indexed="true" stored="false" required="false" />
 <field name="ProductRating" type="float" indexed="true" stored="false" required="false" />
 <field name="color" type="string" indexed="true" stored="false" required="false" />
 <field name="capacity" type="string" indexed="true" stored="false" required="false" />
 <field name="suctionpower" type="string" indexed="true" stored="false" required="false" />
 <field name="noise" type="string" indexed="true" stored="false" required="false" />
 <field name="energyefficiency" type="string" indexed="true" stored="false" required="false" />
 <field name="centrifugation" type="string" indexed="true" stored="false" required="false" />
 <field name="washingcapacity" type="string" indexed="true" stored="false" required="false" />
 <field name="automaticdefrosting" type="boolean" indexed="true" stored="false" required="false" />
 <field name="bestintest" type="boolean" indexed="true" stored="false" required="false" />
 <field name="greenenergy" type="boolean" indexed="true" stored="false" required="false" />
 <field name="discount" type="string" indexed="true" stored="false" required="false" />
 <field name="testwinner" type="boolean" indexed="true" stored="false" required="false" />
 <field name="funded" type="string" indexed="true" stored="false" required="false" />
 <field name="productsubname" type="string" indexed="true" stored="false" required="false" />
 <field name="werecommend" type="boolean" indexed="true" stored="false" required="false" />
<!-- Main body of document extracted by SolrCell.
        NOTE: This field is not indexed by default, since it is also copied to "text"
        using copyField below. This is to save space. Use this field for returning and
        highlighting document content. Use the "text" field to search the content. -->
   <field name="content" type="text_general" indexed="false" stored="true" multiValued="true"/>


   <!-- catchall field, containing all other searchable text fields (implemented
        via copyField further on in this schema  -->
   <field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>

   <!-- catchall text field that indexes tokens both normally and in reverse for efficient
        leading wildcard queries. -->
   <field name="text_rev" type="text_general_rev" indexed="true" stored="false" multiValued="true"/>

   <!-- non-tokenized version of manufacturer to make it easier to sort or group
        results by manufacturer.  copied from "manu" via copyField -->
   <field name="manu_exact" type="string" indexed="true" stored="false"/>

   <field name="payloads" type="payloads" indexed="true" stored="true"/>

   <field name="_version_" type="long" indexed="true" stored="true"/>


 </fields>
 <uniqueKey>ProductID</uniqueKey>
<copyField source="ProductName" dest="text"/>
<defaultSearchField>text</defaultSearchField> 

卡塔利娜原木

aug 14, 2013 11:20:52 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Tomcat\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;;.
aug 14, 2013 11:20:52 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
aug 14, 2013 11:20:52 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
aug 14, 2013 11:20:52 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 374 ms
aug 14, 2013 11:20:52 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
aug 14, 2013 11:20:52 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
aug 14, 2013 11:20:52 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Tomcat\conf\Catalina\localhost\solr.xml
aug 14, 2013 11:20:52 AM org.apache.catalina.startup.HostConfig deployDescriptor
WARNING: A docBase c:\Tomcat\webapps\solr.war inside the host appBase has been specified, and will be ignored
aug 14, 2013 11:20:52 AM org.apache.catalina.startup.SetContextPropertiesRule begin
WARNING: [SetContextPropertiesRule]{Context} Setting property 'debug' to '0' did not find a matching property.
aug 14, 2013 11:20:52 AM org.apache.tomcat.util.digester.Digester endElement
WARNING:   No rules found matching 'Context/environment'.
aug 14, 2013 11:20:54 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Tomcat\webapps\docs
aug 14, 2013 11:20:54 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Tomcat\webapps\host-manager
aug 14, 2013 11:20:54 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Tomcat\webapps\manager
aug 14, 2013 11:20:54 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Tomcat\webapps\ROOT
aug 14, 2013 11:20:54 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
aug 14, 2013 11:20:54 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
aug 14, 2013 11:20:54 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1838 ms

关于如何修复它或调查什么的任何想法?

4

3 回答 3

2

我会添加评论,但没有声誉:(

你检查过:

solr 数据导入错误:索引失败。回滚所有更改

SOLR:索引失败。回滚所有更改。

http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200912.mbox/%3C26676982.post@talk.nabble.com%3E

您收到警告“SimplePropertiesWriter 无法读取:dataimport.properties”,一个建议是在您的 conf 目录中创建一个名为 dataimport.properties 的空白文件,并且不要忘记确保系统对其具有写入权限。

于 2013-08-14T15:09:38.073 回答
1

文件 dataimport.properties 是否存在并检查它是否没有写保护。

我在 wiki 中找到了这个

执行完全导入命令时,它将操作的开始时间存储在位于 conf/dataimport.properties 的文件中(该文件是可配置的)

阅读更多http://wiki.apache.org/solr/DataImportHandler#Commands

于 2013-08-14T20:11:21.627 回答
0

我有这个问题 - 重新启动 tomcat 解决了它......所以: service tomcat7 restart

于 2014-04-22T13:56:08.327 回答