0
votes

I am running a database that acts as the source for data to import into Solr. When I run the command: curl "http://localhost:8983/solr/dataimport?command=full-import&commit=true", the commit fails and the instance does a rollback. Can you help me to figure this out?

Here is the exception stack:

    Jan 27, 2012 4:02:32 PM org.apache.solr.handler.dataimport.DataImporter doFullImport
    INFO: Starting Full Import
    Jan 27, 2012 4:02:32 PM org.apache.solr.core.SolrCore execute
    INFO: [] webapp=/solr path=/dataimport params={command=full-import&commit=true} status=0 QTime=0 
    Jan 27, 2012 4:02:32 PM org.apache.solr.handler.dataimport.SolrWriter readIndexerProperties
    INFO: Read dataimport.properties
    Jan 27, 2012 4:02:32 PM org.apache.solr.update.DirectUpdateHandler2 deleteAll
    INFO: [] REMOVING ALL DOCUMENTS FROM INDEX
    Jan 27, 2012 4:02:32 PM org.apache.solr.core.SolrDeletionPolicy onInit
    INFO: SolrDeletionPolicy.onInit: commits:num=1
      commit{dir=/private/var/www/html/internsolr/solr/example/solr/data/index,segFN=segments_21,version=1320251100987,generation=73,filenames=[segments_21]
    Jan 27, 2012 4:02:32 PM org.apache.solr.core.SolrDeletionPolicy updateCommits
    INFO: newest commit = 1320251100987
    Jan 27, 2012 4:02:32 PM org.apache.solr.handler.dataimport.JdbcDataSource$1 call
    INFO: Creating a connection for entity id with URL: jdbc:mysql://localhost:3306/internshipsearch
    Jan 27, 2012 4:02:32 PM org.apache.solr.common.SolrException log
    SEVERE: Exception while processing: id document : SolrInputDocument[{}]:org.apache.solr.handler.dataimport.DataImportHandlerException:

Unable to execute query: select respondentid,
first_name, last_name,
cmc_email_address, graduation_year,
first_major, additional_major,
sequence, other_major,
organization_name, organization_website,
organization_desc, industry,
job_title, department,
city, state,
country, region,
internship_paid, hourly_salary,
year_undertaken, recommend_again,
employer_supervisor, employer_phone,
employer_email, not_recommended_desc,
full_time_offer, full_time_accept,
attend_summer_classes,
summer_classes_institution,
summer_classes_desc, summer_travel,
summer_travel_city, summer_travel_state,
summer_travel_country,
summer_other_activity,
summer_other_activity_desc, how_discovered, doe_start_month, doe_start_day,
doe_end_month, doe_end_day from interndata Processing Document # 1 at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72) at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.(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.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:596) at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268) at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187) at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359) at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427) at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408) Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

    ** BEGIN NESTED EXCEPTION ** 

    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection refused

    STACKTRACE:

    java.net.SocketException: java.net.ConnectException: Connection refused
      at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
      at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
      at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
      at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
      at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
      at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:240)
      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.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:596)
      at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)
      at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)
      at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)
      at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)
      at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408)


    ** END NESTED EXCEPTION **



    Last packet sent to the server was 0 ms ago.
      at com.mysql.jdbc.Connection.createNewIO(Connection.java:2741)
      at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
      at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
      at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:240)
      ... 11 more

    Jan 27, 2012 4:02:32 PM org.apache.solr.common.SolrException log
    SEVERE: Full Import failed:org.apache.solr.handler.dataimport.DataImportHandlerException:

Unable to execute query: select respondentid,
first_name, last_name,
cmc_email_address, graduation_year,
first_major, additional_major,
sequence, other_major,
organization_name, organization_website,
organization_desc, industry,
job_title, department,
city, state,
country, region,
internship_paid, hourly_salary,
year_undertaken, recommend_again,
employer_supervisor, employer_phone,
employer_email, not_recommended_desc,
full_time_offer, full_time_accept,
attend_summer_classes,
summer_classes_institution,
summer_classes_desc, summer_travel,
summer_travel_city, summer_travel_state,
summer_travel_country,
summer_other_activity,
summer_other_activity_desc, how_discovered, doe_start_month, doe_start_day,
doe_end_month, doe_end_day from interndata Processing Document # 1 at org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:72) at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.(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.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:596) at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268) at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187) at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359) at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427) at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408) Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

    ** BEGIN NESTED EXCEPTION ** 

    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection refused

    STACKTRACE:

    java.net.SocketException: java.net.ConnectException: Connection refused
      at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
      at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
      at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
      at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
      at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
      at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:240)
      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.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:596)
      at org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:268)
      at org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:187)
      at org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:359)
      at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:427)
      at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:408)


    ** END NESTED EXCEPTION **



    Last packet sent to the server was 0 ms ago.
      at com.mysql.jdbc.Connection.createNewIO(Connection.java:2741)
      at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:161)
      at org.apache.solr.handler.dataimport.JdbcDataSource$1.call(JdbcDataSource.java:128)
      at org.apache.solr.handler.dataimport.JdbcDataSource.getConnection(JdbcDataSource.java:363)
      at org.apache.solr.handler.dataimport.JdbcDataSource.access$200(JdbcDataSource.java:39)
      at org.apache.solr.handler.dataimport.JdbcDataSource$ResultSetIterator.<init>(JdbcDataSource.java:240)
      ... 11 more

    Jan 27, 2012 4:02:32 PM org.apache.solr.update.DirectUpdateHandler2 rollback
    INFO: start rollback
    Jan 27, 2012 4:02:32 PM org.apache.solr.update.DirectUpdateHandler2 rollback
    INFO: end_rollback
1

1 Answers

3
votes

This is just a connection error, so check the data sources in the beginning of the data-config.xml file in Solr. It's probably just something simple like a bad URL, incorrect credentials, forgot to put the DB name in the URL, etc. Make sure you can ping the DB server from the Solr server.

The datasource tag should be something like this:

<dataSource type="JdbcDataSource" 
  driver="com.mysql.jdbc.Driver"
  url="jdbc:mysql://database.server.com/database-name" 
  user="user" 
  password="pass"
  name="datasource-name" />

And the entities in your data-config.xml should either have no datasource specified (if you only have one in the file) or should specify the name of the datasource you want to use if there are multiple.

Good luck!