Phil Kulak
Phil Kulak

Reputation: 7230

Solr can't find JDBC driver

I haven't done anything with Java in years, so I'm trying to get this done as simply as possible. I'm running Ubuntu 10.04. So far I've just done:

apt-get install solr-jetty libmysql-java

and set up all my config files to pull in documents from my MySQL database. Now, however, I'm getting this in the logs when I try to do a full import:

SEVERE: Full Import failed
org.apache.solr.handler.dataimport.DataImportHandlerException: Could not load driver: com.mysql.jdbc.Driver Processing Document # 1

Now I'm a bit stuck, because if apt installing libmysql-java didn't get me the JDBC driver, I have no idea what will.

Upvotes: 7

Views: 9917

Answers (3)

user1740288
user1740288

Reputation: 41

put the file mysql-connector-java-5.1.22-bin.jar (or its symbol link) to this directory:

/var/lib/tomcat6/webapps/solr/WEB-INF/lib/

I know this is for tomcat case but you can do the similar.

Upvotes: 4

quickshiftin
quickshiftin

Reputation: 69701

I ended up just symlinking to .jars from /usr/share/java; maybe there's a better way though.

ln -s /usr/share/java/mysql-connector-java.jar \
/usr/share/solr/WEB-INF/lib/mysql-connector-java.jar
sudo ln -s /usr/share/java/mysql.jar /usr/share/solr/WEB-INF/lib/mysql.jar

Upvotes: 4

Lukasz Stelmach
Lukasz Stelmach

Reputation: 5391

These error means that your mysql dirver cannot be found on java classpath and you should just add it to it.

In case of Jetty you should put your database driver in $JETTY_HOME/lib/ext directory. Just put there symbolic link or copy jar file.

If you don't know where is MySql JDBC jar file you can check it using these command:

dpkg-query -L libmysql-java

Or you can just simply download these driver from MySql download page.

PS. I have never used Jetty and I found these information here: http://content.liferay.com/4.2/doc/installation/liferay_4_installation_guide/multipage/ch03.html#d0e893, point 9, Jetty 5.1 installation.

Upvotes: 7

Related Questions