users@jersey.java.net

[Jersey] Error while issuing simultaneous requests with custom SSLContext

From: Fabrizio Cucci <fabrizio.cucci_at_gmail.com>
Date: Fri, 22 Jul 2016 22:29:40 +0100

Hi,

I was playing a bit with the Jersey client when I came across an unexpected
error:

*sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target*

Basically, I was starting multiple threads, creating a Jersey client in
each of them using a custom SSLContext and sending a request to the server.

I've found this issue: https://java.net/jira/browse/JERSEY-3124 which looks
very similar to the problem I'm currently facing. The main difference is
that the guy who reported that was sharing the same Jersey client across
all threads while I'm creating a new one for each of them. I didn't quite
get why the issue was marked as "Works as designed" but I would really like
to understand how to solve the problem.

I've forked his sample project and updated the test code which now
basically shows my issue: https://github.com/fabriziocucci/JerseyBugTest .
Just execute "mvn clean install".

Thanks in advance,
Fabrizio