title: How to fix "TargetHandler I/O error: General SSLEngine problem"
body: <p>i have an API in wso2 esb and i am making a https request to an external endpoint, i have imported a certificate as per the documentation using keytool but i still run into the same error</p>
  
  <p>this is how i have imorted my certificate:
  keytool -importcert -file  -keystore /repository/resources/security/client-truststore.jks -alias "SomeAlias"</p>
  
  <pre><code>[2019-01-02 11:17:06,153] [EI-Core] ERROR - TargetHandler I/O error: General SSLEngine problem javax.net.ssl.SSLHandshakeException: General SSLEngine problem
  at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1529)
  at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:535)
  at sun.security.ssl.SSLEngineImpl.writeAppRecord(SSLEngineImpl.java:1214)
  at sun.security.ssl.SSLEngineImpl.wrap(SSLEngineImpl.java:1186)
  at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:469)
  at org.apache.http.nio.reactor.ssl.SSLIOSession.doWrap(SSLIOSession.java:237)
  at org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(SSLIOSession.java:271)
  at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(SSLIOSession.java:410)
  at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:119)
  at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:159)
  at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:338)
  at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:316)
  at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:277)
  at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:105)
  at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:586)
  at java.lang.Thread.run(Thread.java:748)
  Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
  at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
  at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1728)
  at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:330)
  at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:322)
  at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1614)
  at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
  at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052)
  at sun.security.ssl.Handshaker$1.run(Handshaker.java:992)
  at sun.security.ssl.Handshaker$1.run(Handshaker.java:989)
  at java.security.AccessController.doPrivileged(Native Method)
  at sun.security.ssl.Handshaker$DelegatedTask.run(Handshaker.java:1467)
  at org.apache.http.nio.reactor.ssl.SSLIOSession.doRunTask(SSLIOSession.java:255)
  at org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(SSLIOSession.java:293)
  ... 9 more
  Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
  at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:397)
  at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302)
  at sun.security.validator.Validator.validate(Validator.java:260)
  at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
  at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:281)
  at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:136)
  at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1601)
  ... 17 more
  </code></pre>
  
  <p>Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
      at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
      at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
      at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392)</p>