在配置Solr DataImportHandler以使用JDBC SQLServerDriver連接到SQL Server後啓動Apache Solr Admin(Win7)會產生以下錯誤。 MS Sql JDBC連接器sqljdbc4.jar被放置在Solr的bin和lib文件夾中。Solr DataImporter配置異常
org.apache.solr.servlet.SolrDispatchFilter init
SEVERE: Could not start SOLR. Check solr/home property
org.apache.solr.common.SolrException: FATAL: Could not create importer. DataImporter config invalid
...
Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException: Exception occurred while initializing context
at ...
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog...
solrconfig.xml中具有:
<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" name="hy"
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost;databaseName=test;responseBuffering=adaptive;"
user="test"
password="test"
readOnly="true"/>
<document name="listings">
<entity name="listings" dataSource="hy" pk="ListID"
query = "SELECT ListID, Description, PostDate FROM Listings"
transformer="DateFormatTransformer">
<field column="PostDate" name="PostDate" dateTimeFormat="yyyy-MM-dd" />
</entity>
</document>
</dataConfig>
任何建議將受到讚賞。
我得到同樣的問題,但我有'/'之前dataimport。我知道這與xml config docs有關,但一切都很正常。除了xml doc錯誤之外,是否還有其他任何其他原因? – 2011-03-14 20:06:40