Unable to connect dropwizard using MySQL on docker container

44 views
Skip to first unread message

Alchemist Srivastava

unread,
Mar 4, 2020, 9:14:41 AM3/4/20
to dropwizard-user

Java Version 1.8

mysql-connector-java 8.0.12

My SQL 5.7 deployed on docker 


SUCCESSFULLY connect to workbench


PROPERTIES

database:

  driverClass: com.mysql.cj.jdbc.Driver

  url: jdbc:mysql://localhost:3306/todo?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true

  user: root

  password: pwd

  maxWaitForConnection: 1s

  validationQuery: "/* ToDoService Health Check */ SELECT 1"

  validationQueryTimeout: 3s

  minSize: 8

  maxSize: 32

  checkConnectionWhileIdle: false

  evictionInterval: 10s

  minIdleTime: 1 minute

  checkConnectionOnBorrow: true


ERROR DETAILS

I am trying to test a simple test dropwizard application by using a MySQL server that id deployed on docker. I can connect to the MySQL server just fine from the Workbench. So I know I can connect fine using my userid and pwd.
But when I try to test a simple dropwizar Java application I am getting following exception.

INFO [2020-03-04 13:59:26,161] org.eclipse.jetty.server.handler.ContextHandler: Started i.d.j.MutableServletContextHandler@28babeca{/,null,AVAILABLE} INFO [2020-03-04 13:59:26,182] org.eclipse.jetty.server.AbstractConnector: Started application@1caa9eb6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} INFO [2020-03-04 13:59:26,183] org.eclipse.jetty.server.AbstractConnector: Started admin@1f53481b{HTTP/1.1,[http/1.1]}{0.0.0.0:8081} INFO [2020-03-04 13:59:26,184] org.eclipse.jetty.server.Server: Started @3009ms ERROR [2020-03-04 13:59:32,591] org.apache.tomcat.jdbc.pool.ConnectionPool: Unable to create initial connections of pool. ! com.mysql.cj.exceptions.CJException: Access denied for user 'root'@'localhost' (using password: YES) ! at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ! at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ! at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ! at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ! at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ! at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ! at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ! at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:129) ! at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:810) ! at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:735) ! at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:703) ! at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:132) ! at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:557) ! at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:220) ! at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1443) ! at com.mysql.cj.NativeSession.connect(NativeSession.java:165)

William Herbert

unread,
Mar 4, 2020, 7:30:48 PM3/4/20
to dropwiz...@googlegroups.com
This portion of the error message I believe means it is connecting to something:
com.mysql.cj.exceptions.CJException: Access denied for user 'root'@'localhost' (using password: YES)

It is connecting to a database, but maybe not the one you're expecting it to?  Could it actually be connecting to the mysql server running on the same docker container as your dropwizard application but you want it to connect to a MySQL running on a different docker container?

--
You received this message because you are subscribed to the Google Groups "dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dropwizard-user/d4b0e86c-a8cb-4608-89af-8bfc9cbc7ebe%40googlegroups.com.


--
William Herbert
Wm.He...@gmail.com
Reply all
Reply to author
Forward
0 new messages