You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Joseph C. Trubisz" <jt...@medmeme.com> on 2012/11/28 20:03:21 UTC

Connecting MySQL to Solr 4.0

Anybody have the problem of attempting to use MySQL J/Connector on Solr 4.0 and getting the
Standard Java error: ClassNotFoundException: Unable to load com.mysql.jdbc.Driver.

Problem is that when I go to the admin screen, the driver (which IS there, I did check) fails to show.
In fact, using the 4.0 tutorial, it doesn't show the jetty.jmx jar either.
Tried hardcoding it in the CLASSPATH and that didn't work.

Totally frustrated, so I'm open to any suggestions at this point.

Thanks,
Joe

Re: Connecting MySQL to Solr 4.0

Posted by Shawn Heisey <so...@elyograg.org>.
On 11/28/2012 12:03 PM, Joseph C. Trubisz wrote:
> Anybody have the problem of attempting to use MySQL J/Connector on Solr 4.0 and getting the Standard Java error: ClassNotFoundException: Unable to load com.mysql.jdbc.Driver.
>
> Problem is that when I go to the admin screen, the driver (which IS there, I did check) fails to show.
> In fact, using the 4.0 tutorial, it doesn't show the jetty.jmx jar either.
> Tried hardcoding it in the CLASSPATH and that didn't work.

Your best bet, which should work with any servlet container and require 
no special options, is to create a lib subdirectory off your solr.home 
(where solr.xml that defines your cores lives) and put the mysql driver 
jar there.  Then add sharedLib="lib" to the solr tag in your solr.xml 
file.  This is where I put the mysql jar, as well as the 
dataimporthandler jar and the jars for ICU analysis.

[root@bigindy5 ~]# ls -al /index/solr4/lib
total 8356
drwxr-xr-x. 2 ncindex ncindex    4096 Nov 26 10:26 .
drwxr-xr-x. 6 ncindex ncindex    4096 Nov 28 13:23 ..
-rw-r--r--. 1 ncindex ncindex  216034 Nov 26 10:25 
apache-solr-dataimporthandler-4.1-SNAPSHOT.jar
-rw-r--r--. 1 ncindex ncindex 7407144 Oct 13 17:16 icu4j-49.1.jar
-rw-r--r--. 1 ncindex ncindex   84307 Nov 26 10:25 
lucene-analyzers-icu-4.1-SNAPSHOT.jar
-rw-r--r--  1 ncindex ncindex  832960 Nov  8 20:14 
mysql-connector-java-5.1.22-bin.jar

Thanks,
Shawn