the trustAnchors parameter must be non-empty while invoking the procedure using HTTP adapter

Sreeks picture Sreeks · Feb 17, 2015 · Viewed 7.1k times · Source

I am receiving the following error while trying to connect my REST webservice using HTTP adapter in IBM Mobile First:

"errors": [ "Runtime: Http request failed: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty"

I am passing the user id and password in a base64 encoded format in the headers section of my input.

How do I resolve this error?

Answer

xverges picture xverges · Feb 24, 2015

Yoel's answer got me on track: your adapter is doing an SSL request to a server that is not trusted by the keystore in your MobileFirst server.

You need to import in your server's keystore the certificate chain of the server that you are trying to reach. What I did was

  1. From Firefox, export the certificate chain in PEM format (.crt extension).
  2. In the server/conf folder of your project, import the certificate chain file. If you are using the defaults form the worklight.properties file, this will do it:

    keytool --import -keystore default.keystore -storepass worklight -file remoteServer.crt