sharky
sharky

Reputation: 327

Could not load my.sql.jdbc.Driver, while configuring Solr to import data from mysql Database

I have added "mysql-connector-java-5.1.22-bin.jar" to solr/lib where other jetty.jar files are present. But when in solr/admin I check java.classpath I dont find this mysql.connector jar.. so finally on doing a full import i get the error

"java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Could not load driver: com.mysql.jdbc.Driver Processing Document # 1"

Upvotes: 0

Views: 5310

Answers (2)

Omer Sonmez
Omer Sonmez

Reputation: 1168

For Solr 4.5.1, Add mysql connector to lib folder. Add lib folder path to solrconfig.xml

<lib dir="../../lib" />
<lib dir="../../../contrib/extraction/lib" regex=".*\.jar" />
<lib dir="../../../dist/" regex="solr-cell-\d.*\.jar" />

<lib dir="../../../contrib/clustering/lib/" regex=".*\.jar" />
<lib dir="../../../dist/" regex="solr-clustering-\d.*\.jar" />

<lib dir="../../../contrib/langid/lib/" regex=".*\.jar" />
<lib dir="../../../dist/" regex="solr-langid-\d.*\.jar" />

<lib dir="../../../contrib/velocity/lib" regex=".*\.jar" />
<lib dir="../../../dist/" regex="solr-velocity-\d.*\.jar" />

<lib dir="../../../contrib/dataimporthandler/lib" regex=".*\.jar" />
<lib dir="../../../dist/" regex="solr-dataimporthandler-.*\.jar" />

that is worked for me.

Upvotes: 3

Jayendra
Jayendra

Reputation: 52799

The jars are picked by Solr depending upon your configuration :-

  • solrconfig.xml - the lib directives specified in the configuration file are the lib locations where Solr would look for the jars. So you would need to ensure the jar is present in one of the lib directories.

  • solr.xml - In case of the Multi core setup, you can have a sharedLib for all the collections. You can add the jdbc driver into the sharedLib folder.

Oracle_Example

Upvotes: 4

Related Questions