Java – Solr: Using multiple SQL server data sources results in error: “…\sqljdbc_auth.dll already loaded in another classloader”

javajdbcsolr

I have one Solr instance running in Jetty with JRE 8 with 3 collections (same as cores, yes?) and more to come. I am indexing data from SQL Server, connecting using NTLM as the identity of the Java process. The first core indexes fine, the second one has an error. Here is the abbreviated stack trace.

ERROR - 2014-06-16 11:32:29.897; org.apache.solr.common.SolrException; Full Import failed:java.lang.RuntimeException: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query:
...
Caused by: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: 
...
Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query:
...
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication
...
Caused by: java.lang.UnsatisfiedLinkError: Native Library C:\Program Files\Java\jre8\bin\sqljdbc_auth.dll already loaded in another classloader
...

Based on this stackoverflow answer my understanding is I either need to provide a separate instance of the dll and jar for each index/core, or place the dll jar in a place such that they will get loaded once, by a higher level parent class loader. Right now the jar is in the lib directory within the collection/core/index

My understanding is that sqljdbc4.jar is the who is looking for the dll, so I want both of those to be loaded at the earliest runtime, yes?

I have tried putting the sqljdbc_auth.dll in various bin folders, including one for jre8, for jetty, for solr, for the collection, to no avail.

I have also tried using the jTDS driver, same results but different error.

My intuition tells me that this is a config issue within Solr, not a JRE or Jetty issue. I have looked for relevant configs to change in solr.xml and solrconfig.xml but didn't find anything obvious.

I can post my java.​library.​path and java.​class.​path if that would be helpful.

I should add I am very new to Solr, as in just learned about it last week. My config is very standard. I have a regular Jetty set up and a BitNami setup.

I am stuck. All suggestions welcome. Thank you.

Best Answer

Place the SQL server (or jTDS) JAR in Jetty's boot classpath or the JRE lib/ext folder to make sure it is loaded early.