0

我目前正在开发一个带有 solr 插件的 grails 项目。

圣杯版本:1.3.7

grails start-solr输出:

/path/.grails/1.3.7/projects/projectName/plugins/solr-0.2/scripts/StartSolr.
Starting Solr - Solr HOME is
/path/.grails/1.3.7/projects/projectName/solr-home
Console access: http://localhost:8983/solr/

我根据需要编辑了 data-config.xml 文件:

<dataConfig>
    <dataSource driver="com.mysql.jdbc.Driver"
        url="jdbc:mysql://localhost:3306/database?autoreconnect=true" user="user"
        password="password" />
/*...*/

我还编辑 DataSource 文件:

/*...*/
// environment specific settings
environments {
    development {
        dataSource {
//            dbCreate = "create-drop" // one of 'create', 'create-drop','update'
//            url = "jdbc:hsqldb:mem:devDB"
            dbCreate = "update"
            driverClassName = "com.mysql.jdbc.Driver"
            username = "username"
            password = "password"
            url = "jdbc:mysql://127.0.0.1:3306/database?autoreconnect=true"
        }
    }
/*...*/

我已将 solr 配置重新加载到此 url:

http://localhost:8983/solr/dataimport?command=reload-config

然后,当我访问此网址时:

http://localhost:8983/solr/dataimport?command=full-import

我收到这条消息:

<response>
    <lst name="responseHeader">
        <int name="status">0</int>
        <int name="QTime">11</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:0:8.711</str>
        <str name="Total Requests made to DataSource">0</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">2012-09-20 14:53:56</str>
        <str name="">Indexing failed. Rolled back all changes.</str>
        <str name="Rolledback">2012-09-20 14:53:56</str>
    </lst>
    <str name="WARNING">This response format is experimental.  It is likely to change in the future.</str>
</response>

我忘记了什么吗?

谢谢

4

1 回答 1

0

我终于找到了答案:

打开位于此处的 solr 日志文件后:

tail -f ~/.grails/1.3.7/projects/PROJECT-NAME/solr-home/logs/AAAA_MM_JJ.stderrout.log

我看到以下错误:

坟墓:完全导入失败 org.apache.solr.handler.dataimport.DataImportHandlerException:无法加载驱动程序:com.mysql.jdbc.Driver 处理文档#1

所以我在 mysql 网站上下载了 jdbc 驱动程序:

http://dev.mysql.com/downloads/mirror.php?id=13597

我将包的mysql-connector-java-5.0.8-bin.jar文件移动到这里:

mv mysql-connector-java-5.0.8-bin.jar ~/.grails/1.3.7/projects/PROJECT-NAME/solr-home/lib/

希望它对某人有用!

于 2012-10-25T15:13:48.303 回答