Did you try to send email via smtp over tls with other mail clients? E.g outlook, thunderbird. Do they work? If yes, there might be something wrong in your java code.
If all of them failed, there must be something wrong with your server. Paste output of command "postconf -n" and "dovecot -n" here to help troubleshoot please.