1
votes

I am getting below error while using Mongodb Java Driver to ready data from MongoDB and push it to ElasticSearch-

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

Plateform Info:

OS- RHEL 6.6

Logstash- 5.5.0

Elasticsearch- 5.5.0

Mongodb- 3.2.13

Jars- mongodb-driver-core-3.4.2.jar, mongo-java-driver-3.4.2.jar and bson-3.4.2.jar

Logstash config

input{
jdbc{
jdbc_driver_library => "/home/pdwiwe/logstash-5.5.0/bin/mongo-java-driver-3.4.2.jar"
jdbc_driver_class => "mongodb.jdbc.MongoDriver"
jdbc_connection_string => "jdbc:mongo://hostname:27017?authSource=admin"
jdbc_user => "user"
jdbc_password => "pwd"
statement => "select * from system.users"
}
}
output {
if "_grokparsefailure" not in [tags]{ 
elasticsearch {
hosts => [ "localhost:9200" ]
index => "mongodb-data"
} 
}   
}

Logstash Service Start:

/home/pdwiwe/logstash-5.5.0/bin$ sh logstash -f mongo.conf
1
Are you sure you should not have jdbc_driver_library => "/home/pdwiwe/logstash-5.5.0/bin/mongo-driver-core-3.4.2.jar" instead? - Val
Thanks @peter, I tried wint mongod-driver-core-3.4.2.jar. Still same error- Error: mongodb.jdbc.MongoDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library? - Pravin Dwiwedi
Am also facing the same issue. is there any solution for this..? - Karthikeyan
I did not get so unfortunately I gave up this approach! - Pravin Dwiwedi

1 Answers

0
votes

mongodb.jdbc.MongoDriver is not a Driver class in the mongo-java-driver.

AFAIK - this driver does not support JDBC Various JDBC drivers have wrapped the mongo-java-driver such as Unity, Simba, DbSchema