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 awb3667 <ad...@peopleclick.com> on 2012/08/23 18:09:22 UTC

Data Import Handler - Could not load driver - com.microsoft.sqlserver.jdbc.SQLServerDriver - SOLR 4 Beta

Hello,

I was able to get the DIH working in SOLR 3.6.1 (placed the sqljdbc4.jar
file in the lib directory, etc). Everything worked great. Tried to get
everything working in SOLR 4 beta (on the same dev machine connecting to
same db, etc) and was unable to due to the sql driver not loading.

What i've done:
1. SOLR 4 admin comes up fine(configured solrconfig.xml and schema.xml)
2. Dropped the sqljdbc4.jar in the lib directory
3. Added sqljdbc4.jar to classpath
4. Added dataimporthandler to solrconfig.xml:
<lib dir="../../../dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
<lib dir="../../../contrib/dataimporthandler/lib/" regex=".*\.jar" />

5. Even tried jtds which also gave me errors that the driver could not be
loaded.

Here is my datasource in the data-config.xml (DIH config file):
<dataSource name="db"
type="JdbcDataSource" 
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"         
url="jdbc:sqlserver://DBSERVERNAME;instanceName=INST1;user=solr;password=password;applicationName=solr-DIH;databaseName=scratch"
user="solr" password="password"/>


Here is the error i get when trying to use jdbc connector: 
SEVERE: Full Import failed:java.lang.RuntimeException:
java.lang.RuntimeException:
org.apache.solr.handler.dataimport.DataImportHandlerException: Could not
load driver: com.microsoft.sqlserver.jdbc.SQLServerDriver Processing
Document # 1
        at
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:273)
        at
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:382)
        at
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:448)
        at
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:429)
Caused by: java.lang.RuntimeException:
org.apache.solr.handler.dataimport.DataImportHandlerException: Could not
load driver: com.microsoft.sqlserver.jdbc.SQLServerDriver Processing
Document # 1
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:413)
        at
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:326)
        at
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:234)
        ... 3 more
Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException:
Could not load driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
Processing Document # 1
        at
org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:71)
        at
org.apache.solr.handler.dataimport.JdbcDataSource.createConnectionFactory(JdbcDataSource.java:114)
        at
org.apache.solr.handler.dataimport.JdbcDataSource.init(JdbcDataSource.java:62)
        at
org.apache.solr.handler.dataimport.DataImporter.getDataSourceInstance(DataImporter.java:354)
        at
org.apache.solr.handler.dataimport.ContextImpl.getDataSource(ContextImpl.java:99)
        at
org.apache.solr.handler.dataimport.SqlEntityProcessor.init(SqlEntityProcessor.java:53)
        at
org.apache.solr.handler.dataimport.EntityProcessorWrapper.init(EntityProcessorWrapper.java:74)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:430)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:411)
        ... 5 more
Caused by: java.lang.ClassNotFoundException: Unable to load
com.microsoft.sqlserver.jdbc.SQLServerDriver or
org.apache.solr.handler.dataimport.com.microsoft.sqlserver.jdbc.SQLServerDriver
        at
org.apache.solr.handler.dataimport.DocBuilder.loadClass(DocBuilder.java:899)
        at
org.apache.solr.handler.dataimport.JdbcDataSource.createConnectionFactory(JdbcDataSource.java:112)
        ... 12 more
Caused by: org.apache.solr.common.SolrException: Error loading class
'com.microsoft.sqlserver.jdbc.SQLServerDriver'
        at
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:438)
        at
org.apache.solr.handler.dataimport.DocBuilder.loadClass(DocBuilder.java:889)
        ... 13 more
Caused by: java.lang.ClassNotFoundException:
com.microsoft.sqlserver.jdbc.SQLServerDriver
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.net.FactoryURLClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:422)
        ... 14 more



--
View this message in context: http://lucene.472066.n3.nabble.com/Data-Import-Handler-Could-not-load-driver-com-microsoft-sqlserver-jdbc-SQLServerDriver-SOLR-4-Beta-tp4002902.html
Sent from the Solr - User mailing list archive at Nabble.com.

RES: Data Import Handler - Could not load driver - com.microsoft.sqlserver.jdbc.SQLServerDriver - SOLR 4 Beta

Posted by Claudio Ranieri <cl...@estadao.com>.
Hi Adam,

Try to add the parameter sharedLib="lib" in $SOLR_HOME/solr.xml (<solr persistent="true" sharedLib="lib">).
Copy all jars of Solr to $SOLR_HOME/lib (including the sqljdbc4.jar)
I already a problem with classloader in solr 4.0 and I solved with this configuration.


-----Mensagem original-----
De: awb3667 [mailto:adam.burke@peopleclick.com] 
Enviada em: terça-feira, 28 de agosto de 2012 11:29
Para: solr-user@lucene.apache.org
Assunto: Re: Data Import Handler - Could not load driver - com.microsoft.sqlserver.jdbc.SQLServerDriver - SOLR 4 Beta

Correction. That DID work! Thanks everyone.
-Adam



--
View this message in context: http://lucene.472066.n3.nabble.com/Data-Import-Handler-Could-not-load-driver-com-microsoft-sqlserver-jdbc-SQLServerDriver-SOLR-4-Beta-tp4002902p4003731.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Data Import Handler - Could not load driver - com.microsoft.sqlserver.jdbc.SQLServerDriver - SOLR 4 Beta

Posted by awb3667 <ad...@peopleclick.com>.
Correction. That DID work! Thanks everyone.
-Adam



--
View this message in context: http://lucene.472066.n3.nabble.com/Data-Import-Handler-Could-not-load-driver-com-microsoft-sqlserver-jdbc-SQLServerDriver-SOLR-4-Beta-tp4002902p4003731.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Data Import Handler - Could not load driver - com.microsoft.sqlserver.jdbc.SQLServerDriver - SOLR 4 Beta

Posted by awb3667 <ad...@peopleclick.com>.
Thanks for the suggestion. I went ahead and added that line to the
solrconfig.xml where the lib directives are. When I do a full import, i am
still seeing the sql driver error.

Has anyone been able to use DIH with SQL Server in 4.0 yet? If so, did you
run into this issue? Thanks.
-Adam



--
View this message in context: http://lucene.472066.n3.nabble.com/Data-Import-Handler-Could-not-load-driver-com-microsoft-sqlserver-jdbc-SQLServerDriver-SOLR-4-Beta-tp4002902p4003725.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Data Import Handler - Could not load driver - com.microsoft.sqlserver.jdbc.SQLServerDriver - SOLR 4 Beta

Posted by Kiran Jayakumar <ki...@gmail.com>.
You need to tell solr where your .jar file is located. Something like this
will help:

<lib dir="../../../dist/" regex="sqljdbc4\.jar" />



On Mon, Aug 27, 2012 at 6:19 AM, awb3667 <ad...@peopleclick.com> wrote:

> Yes it does.
>
> I downloaded the file 'sqljdbc4.jar' from Microsoft. I have this same jar
> working with 3.6.1.
>
> Thanks.
> -Adam
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Data-Import-Handler-Could-not-load-driver-com-microsoft-sqlserver-jdbc-SQLServerDriver-SOLR-4-Beta-tp4002902p4003479.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Data Import Handler - Could not load driver - com.microsoft.sqlserver.jdbc.SQLServerDriver - SOLR 4 Beta

Posted by awb3667 <ad...@peopleclick.com>.
Yes it does. 

I downloaded the file 'sqljdbc4.jar' from Microsoft. I have this same jar
working with 3.6.1.

Thanks.
-Adam



--
View this message in context: http://lucene.472066.n3.nabble.com/Data-Import-Handler-Could-not-load-driver-com-microsoft-sqlserver-jdbc-SQLServerDriver-SOLR-4-Beta-tp4002902p4003479.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Data Import Handler - Could not load driver - com.microsoft.sqlserver.jdbc.SQLServerDriver - SOLR 4 Beta

Posted by Lance Norskog <go...@gmail.com>.
Does this class exist in the driver jar?
com.microsoft.sqlserver.jdbc.SQLServerDriver

On Thu, Aug 23, 2012 at 9:09 AM, awb3667 <ad...@peopleclick.com> wrote:
> Hello,
>
> I was able to get the DIH working in SOLR 3.6.1 (placed the sqljdbc4.jar
> file in the lib directory, etc). Everything worked great. Tried to get
> everything working in SOLR 4 beta (on the same dev machine connecting to
> same db, etc) and was unable to due to the sql driver not loading.
>
> What i've done:
> 1. SOLR 4 admin comes up fine(configured solrconfig.xml and schema.xml)
> 2. Dropped the sqljdbc4.jar in the lib directory
> 3. Added sqljdbc4.jar to classpath
> 4. Added dataimporthandler to solrconfig.xml:
> <lib dir="../../../dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
> <lib dir="../../../contrib/dataimporthandler/lib/" regex=".*\.jar" />
>
> 5. Even tried jtds which also gave me errors that the driver could not be
> loaded.
>
> Here is my datasource in the data-config.xml (DIH config file):
> <dataSource name="db"
> type="JdbcDataSource"
> driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
> url="jdbc:sqlserver://DBSERVERNAME;instanceName=INST1;user=solr;password=password;applicationName=solr-DIH;databaseName=scratch"
> user="solr" password="password"/>
>
>
> Here is the error i get when trying to use jdbc connector:
> SEVERE: Full Import failed:java.lang.RuntimeException:
> java.lang.RuntimeException:
> org.apache.solr.handler.dataimport.DataImportHandlerException: Could not
> load driver: com.microsoft.sqlserver.jdbc.SQLServerDriver Processing
> Document # 1
>         at
> org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:273)
>         at
> org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:382)
>         at
> org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:448)
>         at
> org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:429)
> Caused by: java.lang.RuntimeException:
> org.apache.solr.handler.dataimport.DataImportHandlerException: Could not
> load driver: com.microsoft.sqlserver.jdbc.SQLServerDriver Processing
> Document # 1
>         at
> org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:413)
>         at
> org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:326)
>         at
> org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:234)
>         ... 3 more
> Caused by: org.apache.solr.handler.dataimport.DataImportHandlerException:
> Could not load driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
> Processing Document # 1
>         at
> org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:71)
>         at
> org.apache.solr.handler.dataimport.JdbcDataSource.createConnectionFactory(JdbcDataSource.java:114)
>         at
> org.apache.solr.handler.dataimport.JdbcDataSource.init(JdbcDataSource.java:62)
>         at
> org.apache.solr.handler.dataimport.DataImporter.getDataSourceInstance(DataImporter.java:354)
>         at
> org.apache.solr.handler.dataimport.ContextImpl.getDataSource(ContextImpl.java:99)
>         at
> org.apache.solr.handler.dataimport.SqlEntityProcessor.init(SqlEntityProcessor.java:53)
>         at
> org.apache.solr.handler.dataimport.EntityProcessorWrapper.init(EntityProcessorWrapper.java:74)
>         at
> org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:430)
>         at
> org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:411)
>         ... 5 more
> Caused by: java.lang.ClassNotFoundException: Unable to load
> com.microsoft.sqlserver.jdbc.SQLServerDriver or
> org.apache.solr.handler.dataimport.com.microsoft.sqlserver.jdbc.SQLServerDriver
>         at
> org.apache.solr.handler.dataimport.DocBuilder.loadClass(DocBuilder.java:899)
>         at
> org.apache.solr.handler.dataimport.JdbcDataSource.createConnectionFactory(JdbcDataSource.java:112)
>         ... 12 more
> Caused by: org.apache.solr.common.SolrException: Error loading class
> 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
>         at
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:438)
>         at
> org.apache.solr.handler.dataimport.DocBuilder.loadClass(DocBuilder.java:889)
>         ... 13 more
> Caused by: java.lang.ClassNotFoundException:
> com.microsoft.sqlserver.jdbc.SQLServerDriver
>         at java.net.URLClassLoader$1.run(Unknown Source)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>         at java.net.FactoryURLClassLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Unknown Source)
>         at
> org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:422)
>         ... 14 more
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Data-Import-Handler-Could-not-load-driver-com-microsoft-sqlserver-jdbc-SQLServerDriver-SOLR-4-Beta-tp4002902.html
> Sent from the Solr - User mailing list archive at Nabble.com.



-- 
Lance Norskog
goksron@gmail.com