The exception you are getting is self-explanatory - the server is denying access to the given user.
Carefully check your connection string or data source settings and try connecting to the server using the mysql client command line or workbench using the same credentials you are using in the self-written application.
You should try this from the same machine where the Connector/J driver is running.
Mind that users in MySQL are bound to a hostname pattern (https://dev.mysql.com/doc/refman/5.7/en/adding-users.html) which may prevent the same user from working when connecting from different machines.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.