Java JDBC : http client did not trust this server's certificate, closing connection

I created a docker container using:

docker run --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -it docker.elastic.co/elasticsearch/elasticsearch:8.8.2

This prints out the password and the HTTP CA certificate.

When I try to connecting using JDBC I got this exception in the docker logs:

http client did not trust this server's certificate, closing connection

How can I solve this?

What do your jdbc connection parameters look like?
are you able to show us your whole connection string?

you may need to add verifyServerCertificate=false (or something similar) in order to let jdbc connect without verifying authenticity.

The JDBC URL is jdbc:es://localhost:9200
adding verifyServerCertificate=false throws an 'Unkown Parameter' exception.

my apologies that one didn't work. generally, jdbc drivers have a way to disable certificate verification. I'm not entirely sure which flavor you're utilizing for this connection but you should be able to find out from its docs which is the appropriate flag to use in this situation.

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