简体   繁体   English

Solr找不到JDBC驱动程序

[英]Solr can't find JDBC driver

I haven't done anything with Java in years, so I'm trying to get this done as simply as possible. 多年来我没有用Java做过任何事情,所以我试图尽可能简单地完成这项工作。 I'm running Ubuntu 10.04. 我正在运行Ubuntu 10.04。 So far I've just done: 到目前为止我刚刚完成了:

apt-get install solr-jetty libmysql-java

and set up all my config files to pull in documents from my MySQL database. 并设置我的所有配置文件以从我的MySQL数据库中提取文档。 Now, however, I'm getting 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 bit stuck, because if apt installing libmysql-java didn't get me the JDBC driver, I have no idea what will. 现在我有点卡住了,因为如果安装libmysql-java没有得到我的JDBC驱动程序,我不知道会是什么。

These error means that your mysql dirver cannot be found on java classpath and you should just add it to it. 这些错误意味着您无法在java类路径中找到您的mysql驱动程序,您只需将其添加到它。

In case of Jetty you should put your database driver in $JETTY_HOME/lib/ext directory. 如果是Jetty,您应该将数据库驱动程序放在$JETTY_HOME/lib/ext目录中。 Just put there symbolic link or copy jar file. 只需放置符号链接或复制jar文件即可。

If you don't know where is MySql JDBC jar file you can check it using these command: 如果您不知道MySql JDBC jar文件在哪里,可以使用以下命令检查它:

dpkg-query -L libmysql-java

Or you can just simply download these driver from MySql download page. 或者您只需从MySql下载页面下载这些驱动程序即可。

PS. PS。 I have never used Jetty and I found these information here: http://content.liferay.com/4.2/doc/installation/liferay_4_installation_guide/multipage/ch03.html#d0e893 , point 9, Jetty 5.1 installation. 我从未使用过Jetty,我在这里找到了这些信息: http//content.liferay.com/4.2/doc/installation/liferay_4_installation_guide/multipage/ch03.html#d0e893 ,第9点,Jetty 5.1安装。

put the file mysql-connector-java-5.1.22-bin.jar (or its symbol link ) to this directory: 将文件mysql-connector-java-5.1.22-bin.jar (或其符号链接 )放到此目录中:

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

I know this is for tomcat case but you can do the similar. 我知道这是针对tomcat的情况,但你可以做类似的事情。

I ended up just symlinking to .jars from /usr/share/java; 我最终只是从/ usr / share / java symlinking到.jars; maybe there's a better way though. 也许有更好的方法。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM