0

I'm trying to consume a rest api with client and androidannotations. It works perfectly, but when I do an api with an invalid certificate returned me an error.

org.springframework.web.client.ResourceAccessException: I/O error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.; nested exception is javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

I have found several solutions (like Trusting all certificates using HttpClient over HTTPS) to ignore this validation (only in development, production have the correct certificate), but none have managed to combine it with rest and androidannotations client.

Does anyone know how to do?

Community
  • 1
  • 1
alfonsomiranda
  • 102
  • 1
  • 9

1 Answers1

0

Make your annotated service interface implement RestClientSupport like so:

@Rest
public interface MyService extends RestClientSupport

Then you can call

RestTemplate t = service.getRestTemplate();

And follow these instructions:

http://www.jroller.com/jurberg/entry/using_a_hostnameverifier_with_spring

Max Metral
  • 261
  • 3
  • 12