2

I'm trying to add skip certificate checks for https requests in my plugin for development tests, for that I use http-components httpClient artifact version 4.x

Seems like every API call will compile fine, but during runtime I always get errors similar to this one:

java.lang.NoClassDefFoundError: Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory 

How can I solve this issue and make other java program (Jenkins) who uses my plugin, to avoid such thing from happening?

buddy123
  • 5,679
  • 10
  • 47
  • 73
  • See http://stackoverflow.com/questions/34413/why-am-i-getting-a-noclassdeffounderror-in-java - you are probably missing Apache HttpClient JAR file in your Jenkins' classpath. – Jozef Chocholacek Jan 14 '16 at 07:56
  • @JozefChocholacek You are right. I checked the command params and indeed the classpath is missing the httpclient-4.4.jar. How is that supposed to work with dependencies? My plugin is dependant on this lib, and if I run tests I see the classpath contains its as expected, but Other programs using my code as a lib (Jenkins) won't bring the necessary deps. What is the common behavior for such case? – buddy123 Jan 14 '16 at 09:36
  • How is the httpclient dependency defined in pom.xml? Isn't it with the scope `provided`. – Jozef Chocholacek Jan 14 '16 at 09:41
  • @JozefChocholacek I didn't specify the scope. The default is compile – buddy123 Jan 14 '16 at 09:47

1 Answers1

0

Most likely, the apache-http-client library is not on your calss path - the exception suggests that. Hence, this is unrelated to the ignoring of client verification

stevops
  • 429
  • 3
  • 9