# Logstash JDBC Plugin Cassandra Driver Not Loaded Error

**URL:** <https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210>\
**Category:** Logstash\
**Created:** [December 31, 2015, 6:05am UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210 "2015-12-31T06:05:55Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vijay\_Dodla](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@Vijay\_Dodla](https://discuss.elastic.co/u/Vijay_Dodla)\
**Post date:** [December 31, 2015, 6:05am UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/1 "2015-12-31T06:05:55Z")

</div>

Hi All  
Can anyone point me to examples on how logstash can read cassandra DB using JDBC . I tried something like this from logstash installed directory

Step 1 : Create config file for logstash (File name :simple-out-conf) . Below are contents for file  
input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:cassandra://localhost:9160/example"  
jdbc\_user =\>"cassandra"  
jdbc\_driver\_library =\> "$PATH/cassandra-jdbc-2.1.1.jar"  
jdbc\_driver\_class =\> "org.apache.cassandra.cql.jdbc.CassandraDriver"  
statement =\> "SELECT \* FROM example.news"}}

output {stdout { codec =\> json\_lines }}

Step 2: Executed below command on CLI  
./logstash -f simple-out.conf

**ouput :**  
Getting below error on executing above statement  
Settings: Default filter workers: 4  
Error: org.apache.cassandra.cql.jdbc.CassandraDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc\_driver\_library?  
You may be interested in the '--configtest' flag which you can  
use to validate logstash's configuration before you choose  
to restart a running system.  
Not sure what i'm missing .Any help is greatly appreciated .

---

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [December 31, 2015, 10:00am UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/2 "2015-12-31T10:00:26Z")

</div>

Unzip /Users/dodlavijaykumar/Documents/workspace/Java\_Activity\_Project\_1/cassandra-jdbc-2.1.1.jar to check if the org.apache.cassandra.cql.jdbc.CassandraDriver class is present or not.

---

<div class="post-metadata">

**Author:** ![Vijay\_Dodla](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@Vijay\_Dodla](https://discuss.elastic.co/u/Vijay_Dodla)\
**Post date:** [December 31, 2015, 2:40pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/3 "2015-12-31T14:40:06Z")

</div>

Hi Thomas,  
Thanks for replying . I can see the class is present in the path i mentioned ..I unzipped and checked it too .Not sure what i'm missing .

---

<div class="post-metadata">

**Author:** ![Vijay\_Dodla](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@Vijay\_Dodla](https://discuss.elastic.co/u/Vijay_Dodla)\
**Post date:** [December 31, 2015, 3:28pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/4 "2015-12-31T15:28:56Z")

</div>

Hi All, any help on this will be really appreciated .Did anyone tried connecting Canssandra with logstash .

---

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [December 31, 2015, 5:04pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/5 "2015-12-31T17:04:43Z")

</div>

Even from the machine where logstash is running ?

---

<div class="post-metadata">

**Author:** ![Vijay\_Dodla](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@Vijay\_Dodla](https://discuss.elastic.co/u/Vijay_Dodla)\
**Post date:** [December 31, 2015, 5:28pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/6 "2015-12-31T17:28:33Z")

</div>

Thomas,  
I have logstash,Elasticsearch and cassandra running on my local machine . The drivers are also on my local machine .

---

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [December 31, 2015, 5:39pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/7 "2015-12-31T17:39:46Z")

</div>

Try running logstash with debug + verbose mode enabled and --configtest.

Then, debug the .rb file ! As you can see on the source:

> <https://github.com/logstash-plugins/logstash-input-jdbc/blob/0ee3a763b1ccf7eb7d4bed7999a07bef7dea9ae7/lib/logstash/plugin_mixins/jdbc.rb#L132>

The error is thrown by Sequel. Maybe link (ln -s) your JAR in the same directory than sequel jar.

---

<div class="post-metadata">

**Author:** ![Vijay\_Dodla](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@Vijay\_Dodla](https://discuss.elastic.co/u/Vijay_Dodla)\
**Post date:** [January 4, 2016, 2:07am UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/8 "2016-01-04T02:07:41Z")

</div>

Just saw your mail ..will give a try and let you know how it goes .

---

<div class="post-metadata">

**Author:** ![Vijay\_Dodla](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@Vijay\_Dodla](https://discuss.elastic.co/u/Vijay_Dodla)\
**Post date:** [January 4, 2016, 3:49am UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/9 "2016-01-04T03:49:05Z")

</div>

Tried all the combinations ..still getting error . I see configuration is OK .  
./logstash -f simple-out.conf -v --debug --log test.log --verbose --configtest  
Sending logstash logs to test.log.  
Configuration OK  
Configuration OK

Between i tested using mysql jar file to connect MYSQL DB and it worked .Facing problem only with Cassandra DB.

---

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [January 4, 2016, 11:02am UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/10 "2016-01-04T11:02:53Z")

</div>

Try to use your JAR with a small java class you write.

---

<div class="post-metadata">

**Author:** ![Vijay\_Dodla](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@Vijay\_Dodla](https://discuss.elastic.co/u/Vijay_Dodla)\
**Post date:** [January 4, 2016, 5:02pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/11 "2016-01-04T17:02:44Z")

</div>

i used my jar files using eclipse and was able to successfully connect to Cassandra DB .  
One catch is i added all dependent libraries to build path to make it work .

Do you think i need to include all the dependencies when i call Cassandra JDBC jar via logstash ? Here is the error is got when using Cassandra JDBC jar

{:timestamp=\>"2016-01-04T10:44:44.840000-0600", :message=\>"Error: org.apache.cassandra.cql.jdbc.CassandraDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc\_driver\_library?"}  
{:timestamp=\>"2016-01-04T10:44:44.842000-0600", :message=\>"You may be interested in the '--configtest' flag which you can\nuse to validate logstash's configuration before you choose\nto restart a running system."}

i made sure i included all the dependencies in to folder and added this folder to classpath and then executed it.

---

<div class="post-metadata">

**Author:** ![Vijay\_Dodla](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@Vijay\_Dodla](https://discuss.elastic.co/u/Vijay_Dodla)\
**Post date:** [January 4, 2016, 8:36pm UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/12 "2016-01-04T20:36:25Z")

</div>

Finally .. issue is resolved . The problem was with dependencies jars .Instead of using multiple jars i used a single jar with all the dependencies included in it and it worked .  
People who want this integration work please use cassandra-jdbc driver available @ [http://www.dbschema.com/cassandra-jdbc-driver.html](http://www.dbschema.com/cassandra-jdbc-driver.html) .

After you execute you might see following messages warning/error messages . But with these errors data is getting extracted and i was able to load it in to ES .  
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".  
SLF4J: Defaulting to no-operation (NOP) logger implementation  
SLF4J: See [http://www.slf4j.org/codes.html#StaticLoggerBinder](http://www.slf4j.org/codes.html#StaticLoggerBinder) for further details.

Best way is to unjar and have missing jar's included so that you will not see above messages .

Thanks Thomas for your support .

---

<div class="post-metadata">

**Author:** ![Srivastavark](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@Srivastavark](https://discuss.elastic.co/u/Srivastavark)\
**Post date:** [July 2, 2016, 11:14am UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/13 "2016-07-02T11:14:05Z")

</div>

Hi Vijay,

I am facing same issue and nothing is working for me. Using same jdbc driver as mentioned by you.

if logstash conf as below  
input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:cassandra://localhost:9160/esdemo"  
jdbc\_user =\> "cassandra"  
jdbc\_driver\_library =\> "D:\driver\cassandrajdbc1.1.jar"  
jdbc\_driver\_class =\> "org.apache.cassandra.cql.jdbc.CassandraDriver"  
statement =\> "SELECT \* from esdemo.sampledata"  
}  
}  
output {

```
	stdout { codec => json }

```

}

then error is  
Error: org.apache.cassandra.cql.jdbc.CassandraDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc\_driver\_library?

and if below conf,

input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:cassandra://localhost:9160/esdemo"  
jdbc\_user =\> "cassandra"  
jdbc\_driver\_library =\> "D:\driver\cassandrajdbc1.1.jar"  
jdbc\_driver\_class =\> "com.dbschema.CassandraJdbcDriver"  
statement =\> "SELECT \* from esdemo.sampledata"  
}  
}  
output {

```
	stdout { codec => json }

```

}  
then error is  
Pipeline aborted due to error {:exception=\>#\<Sequel::DatabaseConnectionErro  
r: Java::ComDatastaxDriverCoreExceptions::NoHostAvailableException: All host(s)  
tried for query failed (tried: localhost/127.0.0.1:9160 (com.datastax.driver.cor  
e.exceptions.TransportException: [localhost/127.0.0.1] Channel has been closed))

Is anything missed here?  
Cassandra version 2.0.5  
Logstash version 2.3.3

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:49am UTC](https://discuss.elastic.co/t/logstash-jdbc-plugin-cassandra-driver-not-loaded-error/38210/14 "2017-07-06T04:49:48Z")

</div>


