Getting “java.net.SocketException: Connection reset with (SSL- Self Signed Certificate)” while invoking API From Jenkins Plugin Getting “java.net.SocketException: Connection reset with (SSL- Self Signed Certificate)” while invoking API From Jenkins Plugin jenkins jenkins

Getting “java.net.SocketException: Connection reset with (SSL- Self Signed Certificate)” while invoking API From Jenkins Plugin


When it runs in the Jenkins plugin, that means it is loaded and executed on an agent.
Even if that agent was the same machine as the Jenkins main instance:

  • the environment can be different
  • the JDK used might be different (in which case, the jdk/jre/lib/security/cacerts modified might not be the same)

You need to check those two points. Each Jenkins job, once executed, has an environment section which can provide more clues.


Create a custom trust store, add your certificate, and pass that trust store to Jenkins via -Djavax.net.ssl.trustStore=/path/to/store (see this help for details).

This should resolve any ambiguity about whether you modified the proper system trust store or not. Also, you'll avoid all the risks that come with modifying the system trust store.