# Unable to connect to database. Tried 1 times {:error\_message=\>"Java::JavaLang::NoClassDefFoundError: javax/xml/bind/DatatypeConverter"

**URL:** <https://discuss.elastic.co/t/unable-to-connect-to-database-tried-1-times-error-message-java-javax-xml-bind-datatypeconverter/200901>\
**Category:** Logstash\
**Created:** [September 24, 2019, 3:40pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-database-tried-1-times-error-message-java-javax-xml-bind-datatypeconverter/200901 "2019-09-24T15:40:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![raquelg](https://avatars.discourse-cdn.com/v4/letter/r/c0e974/32.png) [@raquelg](https://discuss.elastic.co/u/raquelg)\
**Post date:** [September 24, 2019, 3:40pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-database-tried-1-times-error-message-java-javax-xml-bind-datatypeconverter/200901/1 "2019-09-24T15:40:42Z")

</div>

Hi,  
I am trying to move a table form SQL Server to ElasticSearch with Logstash  
I have installed elasticsearch and logstash 7.3.1 with docker-compose.

# pipeline/logstash has the following configuration:

input {  
tcp {  
port =\> 5000  
}  
}  
input {  
jdbc {  
jdbc\_validate\_connection =\> false  
jdbc\_driver\_library =\> ""  
jdbc\_driver\_class =\> "com.microsoft.sqlserver.jdbc.SQLServerDriver"   
jdbc\_connection\_string =\> "jdbc:sqlserver://server:1433;databaseName=databasename;integratedSecurity=false;"  
jdbc\_user =\> "xx"  
jdbc\_password =\> "xxxx"  
statement =\> "SELECT \* FROM dbo.Table"  
clean\_run=\>true  
}  
}  
#Add your filters / logstash plugins configuration here  
output {  
elasticsearch {  
hosts =\> "elasticsearch:9200"  
user =\> "elastic"  
password =\> "changeme"  
}  
}

According to a recommended workaround in this page I have copied directly sqljdbc42.jar in /usr/share/logstash/logstash-core/lib/jars

# Being the Dockerfile of logstash:

ARG ELK\_VERSION

#[https://github.com/elastic/logstash-docker](https://github.com/elastic/logstash-docker)  
FROM [docker.elastic.co/logstash/logstash:${ELK\_VERSION}](http://docker.elastic.co/logstash/logstash:%24%7BELK_VERSION%7D)

RUN logstash-plugin install logstash-filter-jdbc\_streaming  
RUN logstash-plugin install logstash-filter-aggregate  
RUN logstash-plugin install logstash-input-jdbc  
RUN logstash-plugin install logstash-filter-translate

COPY ./jars /usr/share/logstash/logstash-core/lib/jars  
COPY ./jars /usr/share/logstash/jars  
COPY ./config /usr/share/logstash/config  
COPY ./pipeline /usr/share/logstash/pipeline

#Add your logstash plugins setup here  
#Example: RUN logstash-plugin install logstash-filter-json

# It is not working, the docker logs of logstash is :

[2019-09-24T15:14:52,339][ERROR][logstash.inputs.jdbc] Unable to connect to database. Tried 1 times {:error\_message=\>"Java::JavaLang::NoClassDefFoundError: javax/xml/bind/DatatypeConverter"}  
[2019-09-24T15:14:52,341][ERROR][logstash.javapipeline] A plugin had an unrecoverable error. Will restart this plugin.  
Pipeline\_id:main  
...  
Error: Java::JavaLang::NoClassDefFoundError: javax/xml/bind/DatatypeConverter  
Exception: Sequel::DatabaseConnectionError  
Stack: com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:4098)

Currently I am block, please, could anybody help me?

---

<div class="post-metadata">

**Author:** ![Sigrud](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Sigrud](https://discuss.elastic.co/u/Sigrud)\
**Post date:** [October 22, 2019, 10:36am UTC](https://discuss.elastic.co/t/unable-to-connect-to-database-tried-1-times-error-message-java-javax-xml-bind-datatypeconverter/200901/2 "2019-10-22T10:36:39Z")

</div>

I'm having the same issue (after using that workaround). Did you get past this?

---

<div class="post-metadata">

**Author:** ![Sigrud](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@Sigrud](https://discuss.elastic.co/u/Sigrud)\
**Post date:** [October 23, 2019, 1:21pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-database-tried-1-times-error-message-java-javax-xml-bind-datatypeconverter/200901/3 "2019-10-23T13:21:47Z")

</div>

i was able to solve this issue by removing the installed java version, reinstall java 8 openjdk and setting the JAVA\_HOME path

I don't know if it's required but I also added java\_home/bin to the path variable

---

<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:** [November 20, 2019, 1:21pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-database-tried-1-times-error-message-java-javax-xml-bind-datatypeconverter/200901/4 "2019-11-20T13:21:49Z")

</div>

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