Solr cannot find JDBC driver

I have not done anything with Java for many years, so I try to make it as simple as possible. I am running Ubuntu 10.04. So far, I just did:

apt-get install solr-jetty libmysql-java 

and configure all my configuration files to retrieve documents from my MySQL database. Now, however, I get 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 little stuck because if the apt installation of libmysql-java did not bring me the JDBC driver, I have no idea what will happen.

+7
java ubuntu lucene solr
source share
3 answers

These errors mean that your mysql-dirver cannot be found in the java classpath, and you should just add it to it.

In the case of Jetty, you must put your database driver in the $JETTY_HOME/lib/ext directory. Just put a symlink there or copy the jar file.

If you do not know where the jq file MySql JDBC is located, you can check it using the following command:

 dpkg-query -L libmysql-java 

Or you can simply download this driver from the MySql download page.

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

+7
source share

I ended up just symbolic binding to .jars from / usr / share / java; perhaps there is a better way.

 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 
+4
source share

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

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

I know this is for the tomcat case, but you can do something like this.

+4
source share

All Articles