Hi Artur,
you are connecting to a V21 JCP, so it's using TLS. That includes host name verification: is "localhost" listed in your certificate or do you have to use FQDN instead?. Not sure where your CA root certificate is located, maybe you need to point to it using trustedCertFolder.
Regards, Markus