Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 853
Phil Kulak Avatar asked Nov 13 '10 17:11

Phil Kulak


2 Answers

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.

like image 137
Lukasz Stelmach Avatar answered Sep 23 '22 11:09

Lukasz Stelmach


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
like image 28
quickshiftin Avatar answered Sep 21 '22 11:09

quickshiftin