我在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
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
数据-config.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>
schema.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>
Catalina日志
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
有关如何解决或查看内容的任何想法?
答案 0 :(得分:2)
我会添加评论,但没有声誉:(
你有没有签出:
solr dataimport error: Indexing failed. Rolled back all changes
SOLR: Indexing failed. Rolled back all changes.
您收到警告“SimplePropertiesWriter无法读取:dataimport.properties”,一个建议是在您的conf目录中创建一个名为dataimport.properties的空白文件,并且不要忘记确保系统具有对它的写入权限
答案 1 :(得分:1)
文件dataimport.properties是否存在并检查它是否处于写保护状态。
我在维基中找到了这个
执行完全导入命令时,它会将操作的开始时间存储在位于conf / dataimport.properties的文件中(此文件是可配置的)
答案 2 :(得分:0)
我有这个问题 - 重启tomcat解决了它...所以: service tomcat7 restart