0

I've been able to build and run the example code (from Alain O'Dea) in this older SO thread:

How do I pass the client certificate with HTTP client?

As described in that thread, I downloaded the 4 JAR files and put those into the Eclipse project, then was able to build the .class file and run it successfully.

However, now I want to build the equivalent code/class in a Maven project in Eclipse (using JDK 1.8.x). I setup the new Maven project, then dropped the class code into the project and added a dependency in the pom.xml:

    <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpclient</artifactId>
       <version>4.4</version>
    </dependency>

But when I try to do the maven build with "clean install -U", I am getting an error:

[[1;31mERROR[m] [1;31m/E:/Eclipse-workspace/x/src/main/java/MutualHttpsMain.java:[30,67] cannot find symbol[m
[[1;31mERROR[m] [1;31m  symbol:   method setSSLContext(javax.net.ssl.SSLContext)[m
[[1;31mERROR[m] [1;31m  location: class org.apache.http.impl.client.HttpClientBuilder[m
[[1;31mERROR[m] 

Can someone tell me what is causing that build error, and also how to resolve the problem?

Thanks, Jim

user555303
  • 1,146
  • 3
  • 20
  • 44

1 Answers1

0

I was able to fix the problem. I had to change the dependency to use a newer version of the dependency:

    <dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.5.14</version>
    </dependency>

After that, the Maven build ran all right.

user555303
  • 1,146
  • 3
  • 20
  • 44