title: ApacheHttpClient$Factory throwing java.lang.NoClassDefFoundError Exception
body: <p>I'm trying to run a sample test via Appium on BrowserStack. All the code comes from BrowserStack and uses their sample .ipa file. The following is the log for the error that I'm receiving. </p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/internal/ApacheHttpClient$Factory
  at io.appium.java_client.remote.AppiumCommandExecutor.&lt;init&gt;(AppiumCommandExecutor.java:55)
  at io.appium.java_client.AppiumDriver.&lt;init&gt;(AppiumDriver.java:131)
  at io.appium.java_client.ios.IOSDriver.&lt;init&gt;(IOSDriver.java:82)
  at BrowserStackIOS.main(BrowserStackIOS.java:28)
  Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.internal.ApacheHttpClient$Factory
      at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
      at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
      ... 4 more
  </code></pre>
  
  <p>Here is the line of code that is being referenced at line 28</p>
  
  <pre><code>IOSDriver&lt;IOSElement&gt; driver = new IOSDriver&lt;IOSElement&gt;(new URL("http://"+userName+":"+accessKey+"@hub-cloud.browserstack.com/wd/hub"), caps);
  </code></pre>
  
  <p>In addition to that, I'm using maven. 
  I got my dependencies from <a href="https://search.maven.org/search?q=g:io.appium%20AND%20a:java-client" rel="nofollow noreferrer">https://search.maven.org/search?q=g:io.appium%20AND%20a:java-client</a></p>
  
  <p>Bindings (for java) from <a href="https://selenium.dev/downloads/" rel="nofollow noreferrer">https://selenium.dev/downloads/</a></p>
  
  <p>Regarding the Bindngs, I'm not sure if I installed them correctly.I extracted the zip file and added the .jar files located in the libs folder to my dependencies. 
  This is a screenshot <a href="https://prnt.sc/qoqwzf" rel="nofollow noreferrer">https://prnt.sc/qoqwzf</a>
  This a screenshot of the selenium/remote/internal folder <a href="https://prnt.sc/qoqxh8" rel="nofollow noreferrer">https://prnt.sc/qoqxh8</a></p>
  
  <p>Notes: 
  Never used maven before so I'll just include additional notes:
  I receive a build success when I run mvn install -U 
  I'm only receiving that error when I try to build my project. </p>
  
  <p>What I've done to try and resolve the error:
  I've updated all selenium dependencies to 4.0.0-alpha-4 using <a href="https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java/4.0.0-alpha-4" rel="nofollow noreferrer">https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java/4.0.0-alpha-4</a></p>
  
  <p>I tried editing my pom.xml by:
  Adding the web driver dependency</p>
  
  <pre><code> &lt;dependency&gt;
              &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
              &lt;artifactId&gt;selenium-remote-driver&lt;/artifactId&gt;
              &lt;version&gt;4.0.0-alpha-4&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>Adding the Safari web driver dependency</p>
  
  <pre><code>       &lt;dependency&gt;
              &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
              &lt;artifactId&gt;selenium-safari-driver&lt;/artifactId&gt;
              &lt;version&gt;4.0.0-alpha-4&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>Additional notes:
  My POM.xml looks exactly like the one given in <a href="https://search.maven.org/remotecontent?filepath=io/appium/java-client/7.3.0/java-client-7.3.0.pom" rel="nofollow noreferrer">https://search.maven.org/remotecontent?filepath=io/appium/java-client/7.3.0/java-client-7.3.0.pom</a> with a few additional dependencies, which I've noted above.</p>
  
  <p>The following are the imports that I'm requesting in my main class</p>
  
  <pre><code>import java.net.URL;
  import java.util.List;
  import java.net.MalformedURLException;
  
  import org.openqa.selenium.support.ui.WebDriverWait;
  import org.openqa.selenium.remote.DesiredCapabilities;
  import org.openqa.selenium.support.ui.ExpectedConditions;
  
  import io.appium.java_client.MobileBy;
  import io.appium.java_client.ios.IOSDriver;
  import io.appium.java_client.ios.IOSElement;
  </code></pre>
  
  <p>I also edited the maven compiler source to 7 as per the error I was receiving requesting that I do so due to compiler source 5 being incompatible with what I was running.</p>
  
  <pre><code>&lt;properties&gt;
          &lt;maven.compiler.source&gt;1.7&lt;/maven.compiler.source&gt;
          &lt;maven.compiler.target&gt;1.7&lt;/maven.compiler.target&gt;
      &lt;/properties&gt;
  </code></pre>
  
  <p>The following is the beginning of my pom, which I edited, not sure if this could be an issue or not but I figured someone else would know.</p>
  
  <pre><code>&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;-&lt;/groupId&gt;
      &lt;artifactId&gt;First&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;java-client&lt;/name&gt;
      &lt;description&gt;Java client for Appium Mobile Webdriver&lt;/description&gt;
      &lt;url&gt;http://appium.io&lt;/url&gt;
  </code></pre>
  
  <p>If any additional information is needed please let me know. I'm currently in the process of adjusting my environment so there have been various errors that have come up and gotten resolved. 
  This is the only one I haven't been able to really get my head around. </p>
  
  <p>Edit:
  My Appium dependency is</p>
  
  <pre><code> &lt;dependency&gt;
              &lt;groupId&gt;io.appium&lt;/groupId&gt;
              &lt;artifactId&gt;java-client&lt;/artifactId&gt;
              &lt;version&gt;4.1.2&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>All my current dependencies</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
          &lt;version&gt;4.0.0-alpha-4&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;*&lt;/artifactId&gt;
                  &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;htmlunit-driver&lt;/artifactId&gt;
                  &lt;groupId&gt;*&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;*&lt;/artifactId&gt;
                  &lt;groupId&gt;net.sourceforge.htmlunit&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-support&lt;/artifactId&gt;
          &lt;version&gt;4.0.0-alpha-4&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-api&lt;/artifactId&gt;
          &lt;version&gt;4.0.0-alpha-4&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-safari-driver&lt;/artifactId&gt;
          &lt;version&gt;4.0.0-alpha-4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-remote-driver&lt;/artifactId&gt;
          &lt;version&gt;4.0.0-alpha-4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
          &lt;artifactId&gt;gson&lt;/artifactId&gt;
          &lt;version&gt;2.8.5&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p><strong><em>Deleted</em></strong></p>
  
  <blockquote>
    <p>
                org.apache.httpcomponents
                httpclient
                4.5.9
                compile
            
    <strong><em>Deleted</em></strong></p>
  </blockquote>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;cglib&lt;/groupId&gt;
          &lt;artifactId&gt;cglib&lt;/artifactId&gt;
          &lt;version&gt;3.2.12&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-validator&lt;/groupId&gt;
          &lt;artifactId&gt;commons-validator&lt;/artifactId&gt;
          &lt;version&gt;1.6&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
          &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
          &lt;version&gt;3.9&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-io&lt;/groupId&gt;
          &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
          &lt;version&gt;2.6&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
          &lt;version&gt;5.1.8.RELEASE&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
          &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;
          &lt;version&gt;1.9.4&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;version&gt;1.7.26&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;io.appium&lt;/groupId&gt;
          &lt;artifactId&gt;java-client&lt;/artifactId&gt;
          &lt;version&gt;4.1.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- Thanks for using https://jar-download.com --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
          &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
          &lt;version&gt;4.5.10&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>