Solr could not load MySQL JDBC Driver

  1. Create a folder inside your solr installation directory. (say solr-4.6.1/lib)

  2. Place the mysql-connector-java-5.1.29-bin.jar inside the folder.

  3. Edit solrconfig.xml and put the jar's path

    <lib dir="../../../lib/" regex="mysql-connector-java-5.1.29-bin.jar" />

  4. Restart Solr.

Also please check your URL. It's having //

http://localhost:8983/solr/#/collection1/dataimport//dataimport 

So for those unfortunate souls who end up here. I'm using the latest Solr Docker image (8.4) which is configured so that the solr Unix-user doesn't have any permissions to create/delete folders and whatnot. For some reason I managed to create a lib file which I took for being a directory. After debugging a while I noticed this error, and promptly just changed the

<lib dir="${solr.install.dir:../../../..}/contrib/dataimporthandler/lib" regex=".*\.jar" />

to

<lib dir="${solr.install.dir:../../../..}/contrib/dataimporthandler/" regex=".*\.jar" />

where my postgresql-42.2.10.jar driver is. Otherwise all the other steps apply (edit solrconfig.xml, add data-config.xml, add schema.xml, copy posgresql-*.jar to the container's /opt/solr-8.4.1/contrib/dataimporthandler). Maybe one thing worth of mentioning is that I used Docker's internal network URL instead of localhost: url="jdbc:postgresql://host.docker.internal:5600/my_postgres_db" but I don't think it matters.

And oh, remember to restart Solr after adding the files / making changes =).