Error: mongodb.jdbc.MongoDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?

倾然丶 夕夏残阳落幕 提交于 2019-12-11 17:53:57

问题


Am trying to load mogodb database to elastic search using logstash. I have written below logstash config file and executing it. While running the config file am getting the below error :

  Error: mongodb.jdbc.MongoDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?
  Exception: LogStash::ConfigurationError

Am using mongo-java-driver-3.1.0.jar driver. Please find my logstash config code below.

    input {
  jdbc {

    jdbc_driver_library => "D:\1SearchEngine\data\mongo-java-driver-3.1.0.jar"
    jdbc_driver_class => "mongodb.jdbc.MongoDriver"
    jdbc_connection_string => "jdbc:mongodb://localhost:27017/my_db"
    jdbc_user => ""
    statement => "*"
  }
}

output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "orders"
  }
}

回答1:


try with mongodb_unityjdbc_full.jar instead of ojdbc14.jar

https://github.com/michaelloliveira/traccar-mongodb/blob/master/lib/mongodb_unityjdbc_full.jar

on windows try:

try double anti slash: (without the space between)

jdbc_driver_library => "D:\ \1SearchEngine\ \data\ \mongo-java-driver-3.1.0.jar"

or try single slash:

jdbc_driver_library => "D:/1SearchEngine/data/mongo-java-driver-3.1.0.jar"



回答2:


Paths on Windows are a little wonky. I cannot verify this at the moment, but in the past I had to use a preceding / before the drive letter. And then all / for the path separators. So give this a try:

jdbc_driver_library => "/D:/1SearchEngine/data/mongo-java-driver-3.1.0.jar"



来源:https://stackoverflow.com/questions/50545557/error-mongodb-jdbc-mongodriver-not-loaded-are-you-sure-youve-included-the-cor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!