# Logstash JDBC error java.lang.IllegalStateException

**URL:** <https://discuss.elastic.co/t/logstash-jdbc-error-java-lang-illegalstateexception/128096>\
**Category:** Logstash\
**Created:** [April 16, 2018, 2:55am UTC](https://discuss.elastic.co/t/logstash-jdbc-error-java-lang-illegalstateexception/128096 "2018-04-16T02:55:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kundavaram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kundavaram/32/24287_2.png) [@kundavaram](https://discuss.elastic.co/u/kundavaram)\
**Post date:** [April 16, 2018, 2:55am UTC](https://discuss.elastic.co/t/logstash-jdbc-error-java-lang-illegalstateexception/128096/1 "2018-04-16T02:55:06Z")

</div>

Im running on

- Elastic 6.2.3
- Logstash 6.2.3
- Kibana 6.2.3
- JDBC : sqljdbc\_6.4

My logstash thew below error while reading from SQL server table

_**[ERROR] 2018-04-15 21:39:26.275 [main] Logstash - java.lang.IllegalStateExceptio**_  
_**n: org.jruby.exceptions.RaiseException: (SystemExit) exit**_

my Logstash config

input {  
jdbc {  
jdbc\_driver\_library =\> "C:\Projects\ELKStack\sqljdbc\_6.4\enu\mssql-jdbc-6.4.0.jre9.jar"  
jdbc\_driver\_class =\> "com.microsoft.sqlserver.jdbc.SQLServerDriver"  
jdbc\_connection\_string =\> "jdbc:sqlserver://localhost;databaseName=DBName;integratedSecurity=true;"  
jdbc\_user =\> "SQLODBC"  
statement =\> "select \* from MyTable"  
}  
}  
output {  
elasticsearch {  
hosts =\> "localhost:9200"  
index =\> "%{language}"  
document\_type =\> "%{SystemName}"  
document\_id =\> "%{SystemName}"  
}  
}

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [April 16, 2018, 5:57am UTC](https://discuss.elastic.co/t/logstash-jdbc-error-java-lang-illegalstateexception/128096/2 "2018-04-16T05:57:36Z")

</div>

Look further up in the log. I'm sure there are more useful clues earlier on.

---

<div class="post-metadata">

**Author:** ![kundavaram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kundavaram/32/24287_2.png) [@kundavaram](https://discuss.elastic.co/u/kundavaram)\
**Post date:** [April 16, 2018, 6:46pm UTC](https://discuss.elastic.co/t/logstash-jdbc-error-java-lang-illegalstateexception/128096/4 "2018-04-16T18:46:04Z")

</div>

here is the actual error message. Any thoughts?

Pipeline\_id:main  
Plugin: \<LogStash::Inputs::Jdbc jdbc\_driver\_library=\>"C:\Projects\ELKStack\  
sqljdbc\_6.4\enu\mssql-jdbc-6.4.0.jre9.jar", jdbc\_driver\_class=\>"com.microsoft.  
sqlserver.jdbc.SQLServerDriver", jdbc\_connection\_string=\>"jdbc:sqlserver://local  
host;databaseName=MYDB;integratedSecurity=true;", jdbc\_user=\>"tools  
\myusername", statement=\>"select SystemName from IntegrationSystems", i  
d=\>"973490965e2b62c2bdae0d8a664c638b9219c75f8ac1ec0a8f26b2b504a747fb", enable\_me  
tric=\>true, codec=\>\<LogStash::Codecs::Plain id=\>"plain\_3e8161bd-fa32-4180-8ef8-6  
d46abc20ec3", enable\_metric=\>true, charset=\>"UTF-8"\>, jdbc\_paging\_enabled=\>false  
, jdbc\_page\_size=\>100000, jdbc\_validate\_connection=\>false, jdbc\_validation\_timeo  
ut=\>3600, jdbc\_pool\_timeout=\>5, sql\_log\_level=\>"info", connection\_retry\_attempts  
=\>1, connection\_retry\_attempts\_wait\_time=\>0.5, parameters=\>{"sql\_last\_value"=\>19  
69-12-31 18:00:00 -0600}, last\_run\_metadata\_path=\>"C:\Users\myusername  
/.logstash\_jdbc\_last\_run", use\_column\_value=\>false, tracking\_column\_type=\>"numer  
ic", clean\_run=\>false, record\_last\_run=\>true, lowercase\_column\_names=\>true\>  
Error: com.microsoft.sqlserver.jdbc.SQLServerDriver not loaded. Are you sure y  
ou've included the correct jdbc driver in :jdbc\_driver\_library?  
Exception: LogStash::ConfigurationError  
Stack: C:/Projects/ELKStack/logstash-6.2.3/logstash-6.2.3/vendor/bundle/jruby/  
2.3.0/gems/logstash-input-jdbc-4.3.5/lib/logstash/plugin\_mixins/jdbc.rb:161:in `open_jdbc_connection' C:/Projects/ELKStack/logstash-6.2.3/logstash-6.2.3/vendor/bundle/jruby/2.3.0/gem s/logstash-input-jdbc-4.3.5/lib/logstash/plugin_mixins/jdbc.rb:219:in`execute\_s  
tatement'  
C:/Projects/ELKStack/logstash-6.2.3/logstash-6.2.3/vendor/bundle/jruby/2.3.0/gem  
s/logstash-input-jdbc-4.3.5/lib/logstash/inputs/jdbc.rb:264:in `execute_query' C:/Projects/ELKStack/logstash-6.2.3/logstash-6.2.3/vendor/bundle/jruby/2.3.0/gem s/logstash-input-jdbc-4.3.5/lib/logstash/inputs/jdbc.rb:250:in`run'  
C:/Projects/ELKStack/logstash-6.2.3/logstash-6.2.3/logstash-core/lib/logstash/pi  
peline.rb:516:in `inputworker' C:/Projects/ELKStack/logstash-6.2.3/logstash-6.2.3/logstash-core/lib/logstash/pi peline.rb:509:in`block in start\_input'  
[2018-04-16T13:41:22,817][ERROR][logstash.pipeline] A plugin had an unre  
coverable error. Will restart this plugin.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [April 16, 2018, 6:49pm UTC](https://discuss.elastic.co/t/logstash-jdbc-error-java-lang-illegalstateexception/128096/5 "2018-04-16T18:49:13Z")

</div>

It looks like you have a jar file meant for Java 9, but your JVM is v8 isn't it? Other than that I have no ideas.

---

<div class="post-metadata">

**Author:** ![kundavaram](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kundavaram/32/24287_2.png) [@kundavaram](https://discuss.elastic.co/u/kundavaram)\
**Post date:** [April 16, 2018, 7:57pm UTC](https://discuss.elastic.co/t/logstash-jdbc-error-java-lang-illegalstateexception/128096/6 "2018-04-16T19:57:40Z")

</div>

That was the issue, Thank you so much Magnus !!!

---

<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:** [May 14, 2018, 8:10pm UTC](https://discuss.elastic.co/t/logstash-jdbc-error-java-lang-illegalstateexception/128096/7 "2018-05-14T20:10:24Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
